sine wave problem.
I really can''t think of a way to solve this problem:
I need to create a sine wave that has a specific length(n), an applitude on the positive(a1)
an amplitude on the minus(a2)
The applitudes on the positive and minus differ.
E.g
This is the positive of the sine( a1 )
\
\ /
\+ /
+ +/
--+---+---+--- Between the +''s is the length(n)
/+ +
/ +
/ +¬
/ The negative of the sine( a2 )
/
/Midpoint( the cross between a1 & a2 )
The problem is, how do I create half the sine, at the specfific aplitude, maintaning the exactly half the lenght(n). If anyone could help me with this, I would appreciate. I wouldn''t mind some C/C++ source for something like this, cheers.
Darn it the diagram went weird. Basically, I want to create a half sine wave, with a specific length, and height. Any help appreciated, maybe some code aswell. Cheers.
quote:Original post by s_blue
Darn it the diagram went weird. Basically, I want to create a half sine wave, with a specific length, and height. Any help appreciated, maybe some code aswell. Cheers.
Ok... lets see. Half a sine wave means 0->pi on the x-axis.
Lets say A is the amplitude and n is the number of samples of the sine wave.
double mysizehalf[n]; // insert a number n here
for (i=0;i{
mysinehalf = A*sin((pi/n)*i);
}
does that work? Not sure if I get your question.
"... you act as if stupidity were a virtue."
-- Flight of the Phoenix
oops what happenned?
ok here is the code again
double mysinehalf[n]; // insert number n
for (i=0;i{
mysinehalf = A*sin((pi/n)*i);
}
"... you act as if stupidity were a virtue."
-- Flight of the Phoenix
ok here is the code again
double mysinehalf[n]; // insert number n
for (i=0;i{
mysinehalf = A*sin((pi/n)*i);
}
"... you act as if stupidity were a virtue."
-- Flight of the Phoenix
ok, this is strange......
for(i = 0; i < n; i++)
mysinehalf = A*sin((pi/n)*i);
if this doesn''t work I quit grrrrr darn html
for(i = 0; i < n; i++)
mysinehalf = A*sin((pi/n)*i);
if this doesn''t work I quit grrrrr darn html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement