Results 1 to 3 of 3

Thread: sin cos and tan graphs

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2005
    Posts
    27

    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

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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
    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
  •  



Click Here to Expand Forum to Full Width