|
-
Jan 19th, 2005, 12:40 PM
#1
Thread Starter
Junior Member
sin cos and tan graphs
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
-
Jan 20th, 2005, 04:34 AM
#2
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.
I don't live here any more.
-
Jan 20th, 2005, 04:38 AM
#3
Re: sin cos and tan graphs
 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
Last edited by wossname; Jan 20th, 2005 at 04:44 AM.
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|