Qbasicnews.com
July 25, 2021, 01:42:40 PM
 Pages: [1]
 Author Topic: hi guys, i need help with this  (Read 1775 times)
shuango
New Member

Posts: 8

 « on: March 19, 2003, 04:02:02 PM »

i have a project on graph trigonometry functions.
 Logged
NovaProgramming
Been there, done that

Posts: 1025

 « Reply #1 on: March 19, 2003, 09:41:46 PM »

This is a very vauge question, really.  Umm, so are you saying that you need to find a way to use SINE and COSINE inside of a qbasic profgram?  cause that's easy,

SIN(<number>)
COS(<number>)

actually, to display you would simply put in

PRINT SIN(<number>)

but the question is vauge.  I hope that that helps!!

-NOVA
 Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it .
-----------------------------
wizardlife
Na_th_an

Posts: 1456

 « Reply #2 on: March 20, 2003, 01:20:19 AM »

Quote from: "shuango"
i have a project on graph trigonometry functions.

You want to know how to graph a Sine Wave? For starters you should what the trig ratios represent in the context of sides of a right-triangle. This appears to be a very good tutorial.

As far as graphing it, the 'QB circle' is measured in radians, so if you plug a value into Sin() or Cos() between 0 and 6.28, you'll get values between -1 and 1 that form a smooth curve... anything over or below that range will loop the pattern. You simply need to do some multiplying to expand it.

Code:

CLS
SCREEN 12
FOR Xpos = 0 TO 639
PSET (Xpos, Sin(Xpos / 20) * 200 + 240), 15
NEXT

'untested
 Logged

banAnnA
Member

Posts: 56

 « Reply #3 on: March 20, 2003, 07:12:28 AM »

You're right. Nice to play around with. Maybe it's an idea to print the zero-lines (of x and y) too, to make it somewhat clearer.
 Logged
 Pages: [1]