How can I plot multiple iteration loglog graphs.
4 views (last 30 days)
Show older comments
N0 = 1*10.^9;
n = 3;
T=365*24*3600;
Table = cell(n, 4);
t = logspace(1, 7);
A = logspace(-22,-1);
ylabel('Activity /s^.-1');
xlabel('t');
set(gca,'xscale','log')
L(1) = 4.979*10.^-18;
L(2) = 3.329*10.^-7;
L(3) = 2.874*10.^-5;
for i=2:n
Bsum=0;
for t = 1:1*10.^5:T
Prod1 = 1;
for l = 1:i-1
Prod1 = Prod1*L(l);
end
for j = 1:i
Prod2 = 1;
for k = 1:i t
if k ~= j
Prod2 = Prod2*(L(k) - L(j));
end
end
Sum = Ssum+exp(-L(j)*t)/Prod2;
end
F = Sum*Prod1*N0;
A = Sum*L(i);
Table(i, :) = {i t F A };
fprintf('%d %d %d %d\n', Table{i, :, :});
end
end
My Scipt needs to output graphs for each iteration of i in terms of A against t, at the moment it will do it to i=3 but if I need to more I would like it to automatically plot the graphs like the subplot command.
Currently my code for my graph only outptus the whole of the iteration from 1:3 rather than each iteration
Activity = logspace(-22,-1);
loglog(A,t,'-o')
line(A, t)
Any help will be great!
0 Comments
Accepted Answer
Sindhu Karri
on 27 Mar 2020
You can try using nexttile which is similar to subplot
By using nexttile, loglog inside the for loopyou will be able to plot the graph of (A,t) for each iteration.
Refer to the below link:
More Answers (0)
See Also
Categories
Find more on Line 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!