ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

creating 4 different waveforms using equations

Hi,
 
Sorry if this has been posted previously, but I could not find the solution to my problem. I'm trying to generate 4 different waveforms and output them using a PCI 6229 device. I want to use the following equations to generate these waves.
 
p1  = p*cos(theta)*exp(i*w*t)
p2 = p*cos(theta+pi/4)*exp(i*w*t)
p3 = p*cos(theta+pi)*exp(i*w*t)
p4 = p*cos(theta+3*pi/4)*exp(i*w*t)
 
In the above equation p is the amplitude, theta is an angle in radians, w is the frequency, t is the time in seconds, and i =sqrt(-1). The p*exp(i*w*t) are common to all equations which might simply the block diagram. Is there an example on this?
 
Thank you for any help.
0 Kudos
Message 1 of 4
(3,163 Views)

Sounds like Homework to me....

However put the math in a for loop and use Iteration counter multiplied by 1/Fs to give you a value of t (Time).  Then set n to however many data points you want. Use controls for all the other variables so that you can play around with their values.  Then repeat for the other three equations 🙂

Craig

LabVIEW 2012
0 Kudos
Message 2 of 4
(3,147 Views)

Thanks for the suggestion Craig. I'd like to add that I'm very new to LabVIEW and did not fully understand what you explained.

This particular graph is a part of a larger block diagram. I wanted to generate these four waveforms either using equations or just by playing around with the phases. I've created a VI which mimicks some features I want to have on it, however I've got two issues with this.

Firstly, I don't know how to change the phases so that three of the waves are out of phase by pi/4, pi/2 and pi to the first one.

Secondly, I'm not sure how to use the complex variable (i=sqrt(-1)) in LabVIEW.

Ruf. 



Message Edited by imperial-aero on 02-15-2008 11:20 AM
0 Kudos
Message 3 of 4
(3,139 Views)
Hi Imperial
If you put the sine function in a for loop and then wire the [ I ] count (multiplied by say 0.002 )to its input and run it over say 400 times and graph the Output array you will get a sine wave.  So for your needs you just put the math in a for loop and use the Blue I terminal for time.  The Sqrt(-1) is a complex number.  I have not done a great deal with them but i believe there is a complex number representaion which allows a a Real and Imaginary part to it.  Because your exponential part is imaginary you will use say 0R+1.2I for the number.  This means all your calculations should be in complex form, from what i understand.
Please anybody correct me if I am wrong as i have a very limited experience with complex numbers in LabVIEW 🙂
I would have drawn you a pic but its hometime for me:)
craig
LabVIEW 2012
0 Kudos
Message 4 of 4
(3,128 Views)