matlab does not plot the from origin

조회 수: 2 (최근 30일)
Xingda Chen
Xingda Chen 2020년 4월 6일
댓글: Xingda Chen 2020년 4월 6일
trying to plot my lab result, but the first data point suppose to be (0,0) , can't make matlab plot that....does this happen to everyone?
function phase_freq(f1,p1,f2,p2,f3,p3,f4,p4,f5,p5,f6,p6,f7,p7,f8,p8,f9,p9,f10,p10)
f(1)=f1;
f(2)=f2;
f(3)=f3;
f(4)=f4;
f(5)=f5;
f(6)=f6;
f(7)=f7;
f(8)=f8;
f(9)=f9;
f(10)=f10;
p(1)=p1;
p(2)=p2;
p(3)=p3;
p(4)=p4;
p(5)=p5;
p(6)=p6;
p(7)=p7;
p(8)=p8;
p(9)=p9;
p(10)=p10;
for i = 1:10
phase(i) = (p(i)/f(i))*360;
end
F = [0 3.3 3.76 7.56 11.40 15.29 19.23 23.21 27.24 31.32];
plot(F,phase,'-.r*')
xlim([0 32]);
xticks(F);
%xticklabels({'0','3.3', '3.76' '7.56', '11.40', '15.29', '19.23', '23.21', '27.24', '31.32'});
xlabel('frequency difference in khz')
ylabel('steady state phase difference')
title('constant coupling')
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 4월 6일
Is f(1)==0? In that case, phase(1)=p(1)/f(1) will become inf. If you want to start from origin, then you need to provide a finite value for phase(1).
Xingda Chen
Xingda Chen 2020년 4월 6일
yeah.thanks. stupid mistake!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 2-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