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: 

Problems with Generating a Complex Exponential Wave

Hi,
 
I'm trying to generate waves of the form, p = a*cos(theta)*exp(i*w*t), where t is the time, w is the frequency and theta is just an angle. In my VI (attached),
I used exp(i*w*t) = cos(w*t)+i*sin(w*t) and formed this using the Re/Im to Complex Function. And I used four different values of theta.

However, when I output the values on a graph I only see a straight line, rather than  time-varying sinusoidal waveforms. When I output just the exponential part (without multiplying by different values of theta) I do get a sinusoidally varying waveform. Also, I only get a single line on the graph, even though I'm expecting to obtain four different waveforms corresponding to the four different theta values I used.  I suspect that it's something to do with building arrays, but can't quite figure out why.
 
Thanks for the help.

Ruf.
0 Kudos
Message 1 of 4
(4,451 Views)

Hi imperial-aero,

the problem in your code is the way how you multiply the two arrays (400 Elements and 4 Elements). To get what you want, you have to use a For Loop. See the attached picture. With your multiplikation you get only four values in your result array.

Hope it helps.

Mike

0 Kudos
Message 2 of 4
(4,409 Views)
Hey Mike. Thanks for the worked sample. I tried using your method, but i still keep getting a single line, however i do get a sinusoidal wave 🙂
 
I've tried something different now (please see the attached pic). I basically generated a sine and a cosine wave from the Waveform Generator VI and then followed a similar method to obtain exp(i*w*t). Does the sine waves created by the Waveform Generator have the equation x = a*sin*(w*t)? If it is, then I think I'll get exp(i*w*t).
 
After multiplying by the four cosine values I'm able to obtain four different waves. However, in the picture as you can see the inputs to the waveform graph has a small red dot on it, which I suppose indicates a mismatch between the data types. Is there a way to fix that? I know in your previous program you converted the number type to double precision.
0 Kudos
Message 3 of 4
(4,385 Views)

Hi imperial-aero,

try this vi.

Mike



Message Edited by MikeS81 on 02-17-2008 06:43 AM
0 Kudos
Message 4 of 4
(4,367 Views)