To create a simple model of simple harmonic motion,
I have created an animated VB program which used the equation x=Acos(wt), and I
have assigned a value of 500 to A and a value of 50 to w. In this program, the
circle which I have inserted into the form will oscillate from left to right,
reaching maximum speed at the middle of the path.
THE CODE:-
Dim t As Integer
Private Sub cmd_Start_Click()
Timer1.Enabled = True
End Sub
Private Sub cmd_Stop_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
t = t + 1
x = 500 * Cos(50 * t)
Shape1.Move Shape1.Left + x
End Sub
Private Sub cmd_Start_Click()
Timer1.Enabled = True
End Sub
Private Sub cmd_Stop_Click()
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
t = t + 1
x = 500 * Cos(50 * t)
Shape1.Move Shape1.Left + x
End Sub
No comments:
Post a Comment