Help needed In plotting equations with QBasic

liunx

Guest
Hi, I am a student of Engineering. I am not studying Programming or anything like this, I just happen to have spent some time in the past with Qbasic, Vbasic and little of C for my own interest. The thing is that for a specific lesson in my university, I have to make a program that draws the curves of parametric equations similar to this one:<br /><br />x={2+7cos[sinu + sin121u]}cosu pi/2500 < u < 2*pi<br /><br />The funniest thing is that nobody has tought us about serious programming in any language and they ask us to write code for something like that!<br /><br />Anyway, I decided to recall my programming memories and knowledge (as much as it can be!) and to try to write a code for it in QBASIC. I have also worked with VBASIC but I don;t know how to draw things on screen! Whereas in QBASIC i use the LINE command to connect two different points and show them directly in the screen.<br /><br />So, I tried at first to make code that shows the results of a simpler parametric equation such as<br /><br />y = cos (x)<br /><br />My problem is that I want to draw each point of (x,y) separately but I dont know which command to use. So I used LINE which draws a line between two points (really!) that are being created in the calculations. The difference between two pairs of (x,y) are very small so the size of the line should be insignificant right? well my screen doesn't agree.<br />Thats the code I wrote?br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->for x = -90 to 89<br />y = cos(x)<br />x2 = x+1       ' create a second pair due to lack of knowledge of how to design a single point!<br />y2 = cos(x2) <br /><br />SCREEN 1<br />LINE (x,y) - (x2,y2)<br /><!--c2--></div><!--ec2--><br /><br />this is supposed to draw the results of y = cos (x) <br /><br />but the graphics I get are not the way they should.<br /><br />Sorry for the long post guys, if anybody can help I would appreciate, I can also use Visual Basic if anybody has a proposition to make, thanks!<br /><br /><span class='edit'>This post has been edited by <b>newbie69</b>: 19 May, 2007 - 02:51 AM</span>
</div>
 
Top