Sine And Cosine Curves
Hi all,
i was wondering, how do i draw sine and cosine curves?
thanx
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
 Cosine And Sine
 Help With Cosine And Sine Computations!
 Coding Tan, Sine, And Cosine
 Math  Sine Cosine
 Sine, Cosine, Tangent
 Faster Sine/cosine?
 Sine And Cosine Functions Ect (not The Built In Ones)
 Arc Sine, Arc Cosine, Arc Tangent, In Degrees
 How Can I Use SINE,COSINE,TANGENT,COSECANT,SECANT And COTANGENT On VB.NET2005?
 Cosine
 Arc Cosine Function
 Inverse Cosine
 Curves
 Need Help With Curves...
 Drawing Curves
 RSA And Ellptic Curves
 Drawing Curves
 Smoothing Curves
 I Think I Am Retarted...Problem With Inverse Cosine
 Easy  Inverse Cosine Function
 Inverse Cosine In Event Builder
 Animate And Create Curves In VB
 Color Of Curves With MSChart
 Urgent: Bezier Curves
 Draw Curves On DC Without Curve Compatability?
 {Help Pls}Coordination Work Of Curves And Interpolation
 {Help Pls}Coordinate Programming Of Curves And Interpolation
 How To Draw Curves And Allow User To Handle Them?
 MSchart  Thickness Of The Line Of The Curves
 Plotting Curves Using Values From A Wav File
 How To Find The Area Bounded By Multiple Curves?
 Sine?
 What Is This % Sine Does
 Animated Smooth Curves In Pure Visual Basic!!
 Sine Waves???
 Sine Wave
 Sine Function
 Inverse Tan, Sine & Cos With VB6
 Inverse Sine
 Sine Curve
 Inverse Sine And Tan
 Sine Wave Table
 Fitting A Sine Wave
 Sine Wave Plot
 Drawing Sine Wave In Vb
 Finding Angle With Sine Fucntion In VB
 Measuring Frequencies Of Sine Waves
 Plot Sine Wave On MSChart
 Sine Triangle And Sawtooth Wave Forms
Cosine And Sine
When a call the sine and cosine functions on an angle of 90 surely the answer should be 1 and 0 respectivley. But it returnes some horrible number with and unmentionalble amount of figures.
What am i doing wrong? I know it has something to do with Pi.
Rich
Help With Cosine And Sine Computations!
hello.
i have a problem with VB's cos and sin compuation. it uses radians and i need a degree computation. VB treats the number i enter as radians and i want it to be treated as a degree.
if i enter the value 90, VB will compute the cosine and sine of 90 in radian mode. i need the cosine and sine of 90 in degree mode. as you well know, there is a big difference between the cosines and sines of radian and degree.
i enter the value 90.
what i get is 90 treated as radian.
cos 90 (radian) = 0.4481
sin 90 (radian) = 0.8940
what i need is 90 be treated as degrees or to be able to display the degree computations for it.
cos 90 (degree) = 0
sin 90 (degree) = 1
if i enter 60, the trigonometric functions SHOULD give the answer of:
cos 60 = 0.5
sin 60 = 0.866
and so on and so forth depending on what value i enter.
could someone please help me?
thanks.
Coding Tan, Sine, And Cosine
Mmmmmm bit of problem today.
I am coding a calculator except i need Tangent, Sine, and Cosine. Problem is how do i code them?? Is there a number combo for them or....yteah well how??
Any help would be Graciously accepted.
From Darcey Pollard  President of Evil Penguin Enterprises
Math  Sine Cosine
Ive never used math in vb before andi keep seeing sin and cosine used for rotating. I was wondering, should i just use them to get the displacement, and then set the new coords to that?
Faster Sine/cosine?
Isn't there a faster way to calculate sine/cosine?
After I included about 60 sine/cosine functions per frame my framerate went down by about 1000(!)%
Sine And Cosine Functions Ect (not The Built In Ones)
So i have this huge assignment i have to complete and i have no clue how to do this at all if you could take a look at some of the highlights of this and any help would be appriciated more than you know,
You are to create a small Graphical Calculator containing certain mathematical functions. The
functions include
a) sin(x)
b) cos(x)
c) tan(x)
d) sin1(x)
e) cos1(x)
f) tan1(x)
g) log(x) log base 10
h) ln(x) natural log (base e)
i) x! factorial of x
j) x2 (square of a number)
k) x (square root of a number)
l) 10x
m) ex
n) pi (value of pi = 4*tan1(1))
You CANNOT use any inbuilt functions of VB. You have to write individual codes for all
these functions using the series expansion, formulas, etc given in an attached sheet.
So thats the basis for what i need to do and i have the series approximations they wont copy and paste if anyone can help i can get the link. Thanks you guys
Arc Sine, Arc Cosine, Arc Tangent, In Degrees
Anyone know how to get the arc sine arc cosine and arc tangent in degrees? The atn function gives out radians, and i'm not sure about the conversion... I have a way to do sine/cosine/tangent in degrees, but i'm not sure how to do it the other way around. anyone have any idea?
Cosine
Im using the cosine function in my project but cant get it to work as I want it to.
Code:
Text1.Text = Cos(28)
this gives me the answer 0.962 when the cosine of 28 is 0.882. How can I correct this? Thanks
Arc Cosine Function
hi there! any know how to do arc cosine in vb code? as soon as possible please. i'd really appreciate it! thanks a lot guys!
Inverse Cosine
I want to do the inverse cosine of a number,
you can only inverse values between 1 to 1,
What i want to do:
If a user puts in a number 1 or greater than 1 then i get a message saying Invalid input
If its between those ranges I want it to do the calculation.
I have done the code, but whatever value i put it, i get invalid input
do you know why?
this is the code
Code:
Private Sub cmdInverseCos_Click() 'Calculates the inverse cosine,
If lbldisplay.Caption < 1 Or lbldisplay.Caption > 1 Then
lbldisplay.Caption = "Invalid input for function"
Else: lbldisplay.Caption = Atn(lbldisplay.Caption / Sqr(lbldisplay.Caption * lbldisplay.Caption + 1)) + 2 * Atn(1)
End If
End Sub
Curves
How do i get the corner of a form to Curve?
Thanks.
Need Help With Curves...
Hi yall,
I want to changes the height of something with a curves!
ie.
The smaller it is, the slower it will grow, and the taller
the faster i'll go!
Right now here what i use(never mind when)
But i want to fix to really use a curve!
VB Code:
If (height=100) Then height = 1;If (height>90) Then height = 100;Else height=height * 1.35;End If
Drawing Curves
What would be the easiest way to draw curves (not circles) in Visual Basic using code?
Preferably so that I can define the coordinates of the end and start points.
Any help would be much appreciated
RSA And Ellptic Curves
Hi...just to know if someone figured out how to do, or found codes about these encryption tecniques, for visual basic.
Rsa from 16 to 4096 Bit
Elliptic Curves 113bit type2 Koblitz curve
Elliptic Curves Nyberg Rueppel signature Scheme
Drawing Curves
Hello,
We can use the Line method to draw a line and Circle method to draw a circle or ellipse but could anyone tell me how to make curves in VB.Supposing I want to join 2 lines using a curve,then how can this be done.Please help.
Thanks,
Ekta.
Smoothing Curves
I am drawing a graph and i am trying to make it look smooth. I am not using the MSChart control that provides the smoothing facility. I think that natural cubic splines will do the job but i am not sure how to implement it.
I Think I Am Retarted...Problem With Inverse Cosine
Hi guys I have this crazy problem...I have made a program that calculates the value of a cos. In my case costheta and I am trying to find the angle (theta)...The code is this:
If costheta = 1 Or costheta = 1 Then
If costheta = 1 Then
theta = 0
Else
theta = 3.14159265358979
End If
Else
theta = Atn(costheta / Sqr(costheta * costheta + 1)) + 2 * Atn(1)
End If
Now...This thing works fine if I enter the value costheta from e.g. a textbox.
But in my program the value costheta is calculates from some other variables..While the calculation is right (I have checked it) the result of the code above is crazy..For example if costheta=0,61 then theta must be approximately 2.22 rads. If I enter the value 0,61 from a textbox it works fine but if it is calculated from the program the result is 0.32 rads...What the hell is going on????????????????????
Easy  Inverse Cosine Function
Quite simply as the title says.
I don't know the funciton to calculate the inverse cosine function of a number. ACos(arg) does not appear to work, Any ideas?
Inverse Cosine In Event Builder
I am having trouble figuring out how to do inv cosine...
I can get my formula to work as "cos" but not as inv consine.. or acosine..or arc cos...etc...
plz help... this is the piece I am working on below...
thanks in advance...
barry
=Cos(([TVD_NetFT]/[MD_NetFT])/(180/3.1415926535897932))
Urgent: Bezier Curves
hi guys!
is there a way to draw bezier curves without using the GDI functions? like, drawing the curve as connected lines? i've already got the four control points for the curves.. is there any way to do that? like a formula? thanks!
{Help Pls}Coordination Work Of Curves And Interpolation
I am a newbie on VB, really have no idea to do my project. Could you please go through my case and see whether you could help me solve !and Please forgive my bad English expression.
If you know any part ,pls give advices as well ,thank you !
Say I already have many train's wheel profiles which measured by a system and the x,y coordinate datas are stored as txt files(see attachment .txt) . Each txt file represents a particular wheel 's profile x,y coordinate measured in a particular time. As wheel will wear so the profile curve will be different at different time measurement. I have 3 softwares have to be programming
A.Thickness against Time curve
What I dont know is :
1. If I want to choose a period time of wheel profile text files to be used ,how to do it in VB?
2.After that , I need a y coordinate variable or array to be set (e.g.line 1 or line 2 value)(see attachment "Wheel Porfile curve" so that i will get two intersection points ,point A & B if set the y varibale at line 1 value and get C & D points if set the variable at line line 2 value). And i need is that i choose a period of time of wheel profiles and enter a y variable in my program and after click plot button . The program will plot out a thickness against time curve (see e.g. attachment "thickness against time" )
but there is a big problem has to solve is that when enter a y variable which is 10.22 mm so the wheel profile txt file have no that two intersection points and how to do interpolation to find the 2 intersection points and calculate the thickness by using point B minus point A ,etc.?
B. Wheel rim Slope against Time curve
what i need is:
1. If I want to choose a period time of wheel profile text files to be used ,how to do it in VB?
2. When i set two constant x coordinate in the wheel profile curve , i will get
two y points so slope = y/x ,but how to set constans in vb?(see attachment e.g. rim slope against time)
C. Animation of wheel profiles curve decay (see attachment animation, )
Final thing to do is :
User could select a time interval for the amimation to display and program will show the animation of the wheel profile changes. The wheel trace will show the worn situation gradually same as an animation. For making the animation, a background color line will be used to cover the old one, and then show a new one in another color. In the display, you will see that the decay process looks like the animation.
in e.g. animation of curves decay.JPG , curve 1 will disappear when curve 2 appear and curve 2 will disappear when curve appear.. and go on for many curves animation
{Help Pls}Coordinate Programming Of Curves And Interpolation
I am a newbie on VB, really have no idea to do my project. Could you please go through my case and see whether you could help me solve !and Please forgive my bad English expression.
If you know any part ,pls give advices as well ,thank you !
Say I already have many train's wheel profiles which measured by a system and the x,y coordinate datas are stored as txt files(see attachment .txt) . Each txt file represents a particular wheel 's profile x,y coordinate measured in a particular time. As wheel will wear so the profile curve will be different at different time measurement. I have 3 softwares have to be programming
A.Thickness against Time curve
What I dont know is :
1. If I want to choose a period time of wheel profile text files to be used ,how to do it in VB?
2.After that , I need a y coordinate variable or array to be set (e.g.line 1 or line 2 value)(see attachment "Wheel Porfile curve" so that i will get two intersection points ,point A & B if set the y varibale at line 1 value and get C & D points if set the variable at line line 2 value). And i need is that i choose a period of time of wheel profiles and enter a y variable in my program and after click plot button . The program will plot out a thickness against time curve (see e.g. attachment "thickness against time" )
but there is a big problem has to solve is that when enter a y variable which is 10.22 mm so the wheel profile txt file have no that two intersection points and how to do interpolation to find the 2 intersection points and calculate the thickness by using point B minus point A ,etc.?
B. Wheel rim Slope against Time curve
what i need is:
1. If I want to choose a period time of wheel profile text files to be used ,how to do it in VB?
2. When i set two constant x coordinate in the wheel profile curve , i will get
two y points so slope = y/x ,but how to set constans in vb?(see attachment e.g. rim slope against time)
C. Animation of wheel profiles curve decay (see attachment animation, )
Final thing to do is :
User could select a time interval for the amimation to display and program will show the animation of the wheel profile changes. The wheel trace will show the worn situation gradually same as an animation. For making the animation, a background color line will be used to cover the old one, and then show a new one in another color. In the display, you will see that the decay process looks like the animation.
in e.g. animation of curves decay.JPG , curve 1 will disappear when curve 2 appear and curve 2 will disappear when curve appear.. and go on for many curves animation
How To Draw Curves And Allow User To Handle Them?
I need to draw some curves according data
and allow user to handle them, such as zoom out, zoom in , rotate, hide one curve and so on
I tried mschart but it's very slow and can't handle the curves
give me some help, thanks
MSchart  Thickness Of The Line Of The Curves
I'm using MSchart in one of my applications.
It is writing kurves in type2Dlinemode.
I want to change the thickness of the line of the curves to make it draw a thin hairline curve.
Someone who knows how to change the thickness with code?
How To Find The Area Bounded By Multiple Curves?
I am trying to find the area bounded by several ellipses that my program places in a 2d plane. Attached is an image showing what I am trying to accomplish, I would like to find the shaded area, however, this area changes. Sometimes there are up to 6 ellipses intersecting the area I would like to find. Ideally, I would like to create a program where I could click in the area I want, and it would store the calculated area. I will have to calculate many different areas this way over and over. Any suggestions?
Davido
Sine?
how do you write this in vb?
Ex
a*Sin(117) / Sin(117) = 19 * Sin(44) / Sin(117)
What Is This % Sine Does
hai,
What is this % sine does?
Code:
Private Sub cmdEnterTemps_Click()
Cls
Days = InputBox("How many days?", "Create Array")
If Days > 0 Then ReDim Temperatures(Days)
Prompt$ = "Enter the high temperature."
For i% = 1 To Days
Title$ = "Day " & i%
Temperatures(i%) = InputBox(Prompt$, Title$)
Next i%
End Sub
Animated Smooth Curves In Pure Visual Basic!!
Hi all,
This will show, how to draw smooth BEZIER and BSPline curves, of any number of control poinrs with a single function call. (not using cubic patches. Very much suitable for random visualisation). The best part is it is purely written in Visual Basic code , no external components.
The code is purticularly useful for Vector graphics, visualisation, Data representation, Interpolation etc...
It also shows u how to :
 draw a Bezier curve
 draw a BSPline curve
 draw a Fractal curve
 apply a 2Dimensional Trasformation to a set of points(rotation,scaling etc.)
 map 3D coordinates to 2D surface.
 apply 3D transformation.
Full source code and Detailed Demos are included...
Exaple code:
Code:
'===================================================
' Function to draw a BSP curve.
'===================================================
Public Function DrawBSP(hdc As Long, p As PointArray, c As Long)
Dim i As Integer, j As Integer, x As Long, y As Long
Dim u As Double, nc1 As Double, nc2 As Double, nc3 As Double, nc4 As Double
Dim dummyp As POINTAPI, curP As Long, prevP As Long
Dim xt As Long, yt As Long
Dim dp As PointArray
If (Segments <= 1 Or Segments >= 500) Then SetSmooth (100)
curP = CreatePen(0, 1, c)
prevP = SelectObject(hdc, curP)
Transform2d p.point(0).x, p.point(0).y, xt, yt
MoveToEx hdc, xt, yt, dummyp
dp.count = p.count + 1
For i = dp.count To 1 Step 1
dp.point(i).x = p.point(i  1).x
dp.point(i).y = p.point(i  1).y
Next i
dp.point(0).x = dp.point(1).x
dp.point(0).y = dp.point(1).y
For j = dp.count To dp.count + 1
dp.point(j).x = dp.point(j  1).x
dp.point(j).y = dp.point(j  1).y
Next j
For i = 1 To j  3
For u = 0# To 1# Step (1# / Segments)
nc1 = (u * u * u) / 6# + (u * u) / 2#  u / 2# + 1# / 6#
nc2 = (u * u * u) / 2#  (u * u) + 2# / 3#
nc3 = ((u * u * u) + u * u + u) / 2# + 1# / 6#
nc4 = (u * u * u) / 6#
x = nc1 * dp.point(i  1).x + nc2 * dp.point(i).x + nc3 * dp.point(i + 1).x + nc4 * dp.point(i + 2).x
y = nc1 * dp.point(i  1).y + nc2 * dp.point(i).y + nc3 * dp.point(i + 1).y + nc4 * dp.point(i + 2).y
Transform2d x, y, xt, yt
LineTo hdc, xt, yt
Next u
Next i
SelectObject hdc, prevP
DeleteObject curP
End Function
Enjoy!!
Sine Waves???
Is there an algorithm I could use to draw a sine wave? Does anyone know of one or at least where I can get a reliable one.
Thanks.
Sine Wave
How do you produce a sine wave, given any frequency? What's the formula? (Which also fits into conventional pcm bitrates/Hz.)
I don't even know whattheheck I should be googling for ("sine wave" site:.ac.uk doesn't return much of any obvious use.)
There is just one, relatively easy formula for calculating a basic sine wave  right??? Or am I out of my depth on this one?
Thanks!
Sine Function
http://www.urphoto.com/users/43974/2...82686nbfeo.jpg
calculate the sine x to n terms. The GUI should consist of two Textboxes, a label and a button. One Textbox should allow the user to input the user of x in radians (2p radians in a circle). The second Textbox should allow the user to input the number of term n. Display the results in a Label. The calculation should be performed and displayed when the button is pressed.
and here is my Program
Option Explicit
Dim x As Double 'X input
Dim n As Double 'N input
Dim answer As Double ' Final answer
Dim countQ As Integer 'counter
' Convert input (X) to radian
Private Function Convert_To_Radian(I As Double) As Double
x = (I * 3.14) / 180
End Function
'Check
Private Sub Cmdcheck_Click()
Form1.Height = 4980
Label4.Caption = "sin(" + txtinX + ")"
Label5 = Sin(x)
End Sub
'Display Answer
Private Sub CmdDisplay_Click()
Dim p As Integer
x = txtinX.Text
n = txtin_N.Text
Call Convert_To_Radian(x) 'ok
p = 1
'Call FAC_X(x)
'Call fac(txtinX)
answer = 0
For countQ = 2 To n
For p = 3 To n Step 2
answer = FAC_X(x) / fac(x)
Next
If (countQ + 1) / 2 = 0 Then
answer = answer  answer
Else
answer = answer + answer
End If
Next
Label1 = x  answer answer = 0
For countQ = 2 To n
For p = 3 To n Step 2
answer = FAC_X(x) / fac(x)
Next
If (countQ + 1) / 2 = 0 Then
answer = answer  answer
Else
answer = answer + answer
End If
Next
Label1 = x  answer
End Sub
Private Function fac(y As Double) As Double
If y <= 1 Then
fac = 1
Else
fac = y * fac(y  1)
End If
End Function
Private Function FAC_X(a As Double) As Double
Dim temp As Double
temp = 1
For countQ = 1 To txtinX
temp = temp * a
Next
FAC_X = temp
End Function
'Clear
Private Sub CmdClr_Click()
txtinX = ""
txtin_N = ""
Label1 = ""
Label5 = ""
End Sub
I think there is something wrong with the red part.
Can anyone help me? thx!!~
Inverse Tan, Sine & Cos With VB6
I'm currently making an application in VB6 but I need to use tan, sine, cos functions and also thier inverse functions but I'm not getting the same results as I do as from a calculator.
For VB: cos(30) = 0.1542 (4dp)
For calc: cos(30) = 0.8660 (4dp)
Also how do I do inverse cos, sine & tan functions??
Inverse Sine
How do I use sine and and inverse sine in VB.NET.....???
I tried
Sin(Number)
Asin(Number)
But I was told that the functions weren't declared....
Sine Curve
How can I draw a simple sine curve on a form....???
Sine Wave Table
I've searched the Net for ages on this and I can't find anything very helpful. I need to create a sine wave lookup table that has the following criteria:
1. The wave is completed within 90 steps (the size of my array)
2. The height of the wave dosn't exceed (charMax.cy / 2)
Here is the code I have so far
Code:
Dim i As Long
For i = 0 To 90
sineTab(i) = Sin(i * Pi / 90) * (charMax.cy / 2)
' Debug.Print CStr(sineTab(i))
Next i
This is not working, as it creates a u shape instead of a sine wave shape. Please help with this alg, I know this should be easy, I just can't figure it out!
MODs: Sorry, I meant to place this in General, feel free to move
Fitting A Sine Wave
Hello
I am pretty new to VB (have been teaching my self for a week), but have had a good look around this site and a number of others and have been unable to find code that can fit a sine function to a set of data and return the relative information (amplitude, phase, frequency).
Is this at all possible? I have seen other fitting programs that require you to vary the setting, but this is not possible for me as it will need to be done in a loop with a large number of samples.
Any help is much appreciated.
Sine Wave Plot
Hi anybody I want to plot a sine wave on a form I have tried the following code but no plot at all please help I'm using VB6 and math is not one of my strong points.
Code:
Private Sub Form_Load()
Dim sine(255)
For x = 0 To 255
sine(x) = Sin(x * 3.14159)
PSet (sine(x), x)
Next x
End Sub
Finding Angle With Sine Fucntion In VB
Hi, I'm trying to determine how to determine one of the complimentary angles of a right triangle, using cosine or sine.
But before doing that, I'm messing around with the sine function in VB to see exactly what it does.
In math, as you all know, Sine30<degrees> equals 1/2 or 0.5 (which is height/hypotenuse).
I checked to see it gives the same result when I do this in VB:
text1.text = sin(30)
I run the program and the textbox has "0.9880316240928"
So, I guess I'm not using "Sin()" properly to get the value 0.5. Can anyone tell me how to use Sin() so that I can get a value of 0.5 when trying to determine the Sin of 30degrees (again, for a right triangle).
Second, if I know my height and hypotenuse, can anyone tell me how to determine the angle of one of the complimentary angles of the right triange? I've searched the 'net to refresh me with sine and cosine, since it's been years since I've had to do homework on it, but I haven't been able to find how to determine the angle.
Measuring Frequencies Of Sine Waves
need help  I'm getting really weird about this stuff.
I need source code for a program that reads data from a wave file
with a sine wave in it and then displays the frequency of the tone
in Hz.
This can't be so hard, but I haven't found anything about this in some
search engines.
I want to write a program which can decode german BOSZVEI tone sequences (a sequence of 5 sinetones  used with pagers for german firefighters ). It's something like dial tones. The Tones are sine waves with a specific frequency for a number.
I.E the sequence for calling a pager with the number 12345 is to
send 5 tones with the frequencies of
1060Hz  1160Hz  1270Hz  1400Hz and 1530Hz
each tone with a duration of 80millisecons
The program I want to write should record a wave file  then open it  and check it for sine waves with these specific frequencies and give out the depending numbers from 0 to 9
then if a specific callingnumber is detected it should perform an action like sending an sms for example
Hope that someone can help me  I'm frustrated that I haven't found anything for use with VB6
Christian
Plot Sine Wave On MSChart
Does anybody know how to plot a sine wave from mschart
I have tried several ways, none of them work
here is sample
Private Sub cmdPlot_Click()
Dim x(100) As Double
Dim i As Integer
For i = 0 To 99
x(i) = Sin(0.1 * i)
Next i
With MSChart1
.chartType = VtChChartType2dLine
For i = 0 To 99
.Data = x(i)
Next i
End With
End Sub
Sine Triangle And Sawtooth Wave Forms
i need to make Vb generate sine sawtooth and triangle wave forms that are then outputted to an osilloscope though the Pcs NTPORT.
ive got a sqaure one sorted and the outputting to the scope is done. but i aint got a clue about doing the other 3 waves.
any pointers or ideas would be a great help.
Thanks
Roxy
