Why is plot not showing a line?

2 次查看(过去 30 天)
%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)))

回答(1 个)

Astarag Chattopadhyay
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)))

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by