Why is plot not showing a line?

조회 수: 3 (최근 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 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