matlab does not plot the from origin

2 views (last 30 days)
Xingda Chen
Xingda Chen on 6 Apr 2020
Commented: Xingda Chen on 6 Apr 2020
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 Comments
Ameer Hamza
Ameer Hamza on 6 Apr 2020
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 on 6 Apr 2020
yeah.thanks. stupid mistake!

Sign in to comment.

Answers (0)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!