how to plot a graph from the results of for loop

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

 Accepted Answer

plot (p,A,'o');
hold on

4 Comments

Mr.Azzi Abdelmalek, Still it's not generating the plot, The plot window pop out with an blank page. I have also tried the plot(p,A) & hold on; in and out side of the For Loop.
any other way!!!
For your data I will add after a for loop
set(gca,'xscale','log')
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')

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots 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!