how to plot a graph from the results of for loop
1 view (last 30 days)
Show older comments
Aravind Kilaru
on 7 Nov 2013
Commented: Aravind Kilaru
on 7 Nov 2013
I want to plot a graph using X axis as p values and y axis as A values there is an error in the code...
any suggestions
clc;
close all;
clear all;
for p=[1.0 0.3 0.1 0.03 0.01 0.003 0.001];
p1=1;
f=30;
h=0.136;
t=65.5;
l=09;
lo=78;
R=224;
Reo=8500;
A = a2(p,p1,f,h,t,l,lo,R,Reo); %calling function from other matlab file
disp(p);
disp(A);
%plot (p,A);
end
0 Comments
Accepted Answer
Azzi Abdelmalek
on 7 Nov 2013
Edited: Azzi Abdelmalek
on 7 Nov 2013
plot (p,A,'o');
hold on
4 Comments
Azzi Abdelmalek
on 7 Nov 2013
For your case, I will do
clc;
close all;
A=[];
p=fliplr([1.0 0.3 0.1 0.03 0.01 0.003 0.001])
for k=1:numel(p)
p1=1;
f=30;
h=0.136;
t=65.5;
l=09;
lo=78;
R=224;
Reo=8500;
A(k) = a2(p(k),p1,f,h,t,l,lo,R,Reo);
disp(p(k));
disp(A(k));
end
plot(p,A)
set(gca,'xscale','log')
More Answers (0)
See Also
Categories
Find more on Specifying Target for Graphics Output in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!