How to get multiple plot for two loops
Afficher commentaires plus anciens
I have a code where I run two loops . one for s1 and other for s2. For each s1 and s2. I get a solution for my variable say z and h and i store it in a matrix. Now i need to plot this . Say I run two loops with 10 , 10 gaps then i get z as 10by 10 matrix and h as 10 by 10 matrix . So I need multiple plots where X axis is z and y is h.
I am pasting the Main file of my code.
% time series simulation for entire linear model
%-----------------------------------------------------------------------------------
tic
clear
%close
T=2000;
tau = [0,T]; %time interval
s1=linspace(0,20,10);
s2=linspace(0.2,0.7,10);
for i=1:length(s1)
for j=1:length(s2)
u0 = [0.70 0.25 0.0 0.0 0.5 0.05 2]; %initial condition
para =parametersurf(s1(i),s2(j));
opts = odeset('RelTol', 2.22045e-14,'AbsTol', 2.22045e-14);
[t,uu] = ode45(@modelsurf,tau,u0,opts,para);
Z1=0:1:T;
u=interp1(t,uu,Z1,'spline');
ssol=u(:,1);
ysol=u(:,2);
y_ssol=u(:,3);
y_tsol=u(:,4);
fssol=u(:,5);
zsol=u(:,6);
hsol=u(:,7);
A(i,j)=zsol(end);
B(i,j)=hsol(end);
end
end
plot(A,B)
hold on
toc
By putting command for plot I get single line but I should multiple plots . For i=1 , i should get one 10 points (as j=10). Then i=2(j=10)....................like this
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!