Re: sin cos and tan graphs
You are trying to use Degrees when you should be converting to radians first...
Radians = Degrees * (pi / 180)
Usually, Trig functions normally assume you are passing radians to them.
Roboplot (check the link in my sig) does this kind of graphic plotting. Although its not available yet.
Re: sin cos and tan graphs
Quote:
Originally Posted by krishna830
hey guys im trying to make sum y=sin, cos and tan x graphs but i dont no how. im trying a method where i use for statements to draw graphs but im getting sum wild results. heres my code
Private Sub cmdSin_Click()
For z = -360 To 360 Step 0.1
x = z
y = 1000 * Sin(x * 1000)
picGraph.Circle (xOrigin + x, yOrigin + y), 1
Next z
End Sub
my teacher insists that he says the graph. but i dont c nething.
thanks for the help
By the way, I'd use picGraph.Pset instead of Circle (its much faster)
Code:
private function ToRadians(degrees as double) as double
ToRadians = degrees * 0.01745329
End function
Private Sub cmdSin_Click()
For x = -360 To 360 Step 1
y = 1000 * Sin(ToRadians(x))
picGraph.Pset (xOrigin + x, yOrigin + y), VBBlack
Next x
End Sub