Why is plot not showing a line?

2 ビュー (過去 30 日間)
Arturo Aguirre
Arturo Aguirre 2018 年 2 月 2 日
回答済み: Astarag Chattopadhyay 2018 年 2 月 5 日
%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
Astarag Chattopadhyay 2018 年 2 月 5 日
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 Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by