Why is plot not showing a line?

2 visualizaciones (últimos 30 días)
Arturo Aguirre
Arturo Aguirre el 2 de Feb. de 2018
Respondida: Astarag Chattopadhyay el 5 de Feb. de 2018
%My plot shows nothing
f0=1000;
k0Prima=((2*pi*f0)/343);
d1=0.3; d2=0.6;
k0Img=linspace((k0Prima/100),(k0Prima/5),1000);
k=k0Prima + 1i*k0Img;
r=1;
p2=exp(-1i*k.*d2) + r*exp(1i*k.*d2);
p1=exp(-1i*k.*d1) + r*exp(1i*k.*d1);
H=p2/p1;
modulo=abs(H);
subplot(2,1,1);
plot(k0Img,modulo)
subplot(2,1,2);
plot(k0Img,unwrap(angle(H)))

Respuestas (1)

Astarag Chattopadhyay
Astarag Chattopadhyay el 5 de Feb. de 2018
Hi,
The size of X-axis data and Y-axis data is not the same in the 'plot' command of the above code snippet. As I understand for this plot command:
"plot(k0Img,modulo)"
It should be a horizontal line parallel to X-axis. The proper command should be like the following:
plot(k0Img,modulo*ones(size(k0Img)))

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by