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 MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

plotting an N-element array of displacement values of an AM wave

Can please somebody check my code and tell me what I ma doing wrong. I am trying to write a code for AM modulated wave of amplitude A to plot N element array of displacement values. I am writing this code in MATH Script.

The code is

delta_t=1/f_s
start=0
step=t
stop=(N-1)*delta_t
t=start:step:stop
A=input('enter amplitude of the wave');
fmod=input('enter modulation frequency');
fsig=input('enter signal frequency');
ym=A*sin(2*pi*fmod*t);
ys=sin(2*pi*fsig*t);
y=(A+ym)*sin(2*pi*fsig*t)
subplot(3,1,1)
plot(t,y);

0 Kudos
Message 1 of 5
(6,133 Views)

You have step = t, do you want to have step = delta_t?

0 Kudos
Message 2 of 5
(6,111 Views)

I have written a MATH script code to plot the AM wave. I think there is some error, because I am getting a straight line instead of wave pattern.

 

Thanks in advance for your help

Download All
0 Kudos
Message 3 of 5
(6,108 Views)
0 Kudos
Message 4 of 5
(6,102 Views)

Merged the threads.

Message 5 of 5
(6,068 Views)