Why is plot not showing a line?

2 visualizzazioni (ultimi 30 giorni)
Arturo Aguirre
Arturo Aguirre il 2 Feb 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)))

Risposte (1)

Astarag Chattopadhyay
Astarag Chattopadhyay il 5 Feb 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)))

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by