Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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.

2 visualizaciones (últimos 30 días)
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);

Respuestas (1)

Jacob Ward
Jacob Ward el 5 de Sept. de 2017
Editada: Jacob Ward el 5 de Sept. de 2017
First off, please try to stick to the guidelines for posting questions to this site. See this answer for help in that area:
While it's a little bit unclear what you are asking for, changing the multiply to a dot multiply in the line y=(A+ym).*sin(2*pi*fsig*t) got rid of the errors that I was seeing and at least produced some results. See below:
f_s = 200;
t = .1;
N = 2000;
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); % I changed the * in this line to a .*
% I also removed the subplot command because it's not needed
plot(t,y);
Is this what you were looking for?

La pregunta está cerrada.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by