How do I plot a graph with a variable changing values without a for loop?
2 views (last 30 days)
Show older comments
I am trying to get a graph with 4 plots where a variable in my code 'X6' is changing from .5 to 1 to 3 to 5. How do I do this since it isn't in even increments? Here's the code (ignore the comments was just trying something out):
function Sonichedgehog_driver
[t,y] = ode45(@Sonichedgehog, [0 24], [3.1 21.2 0.44 .17 1.1]);
dX_1 = y(:,1);
dX_2 = y(:,2);
dX_3 = y(:,3);
dX_4 = y(:,4);
dX_5 = y(:,5);
%plot(t, dX_1, 'g', t, dX_2, 'b', t, dX_3, 'r');
plot(t,dX_1);
%hold on
%plot(t,dX_2);
%hold on
%plot(t,dX_3);
%legend({'Ptc1', 'Gli1', 'Gli2'});
%xlabel('SHH');
%ylabel('Ptc1,Gli1, Gli2');
%title('Sonic Hedgehog Signaling Pathway');
function dX = Sonichedgehog(t, y)
alpha1=1.78;
alpha2=.14;
alpha3=19.77;
alpha4=24.88;
alpha5=13.3;
beta1=.2;
beta2=.03;
beta3=6.88;
beta4=1.35;
beta5=24.99;
%X1 = 3.1;
%X2 = 21.2;
%X3 = 0.44;
%X4 = 0.17;
%X5 = 1.1;
X6=5;
X1 = y(1);
X2 = y(2);
X3 = y(3);
X4 = y(4);
X5 = y(5);
dX = zeros(5,1);
dX(1)= (alpha1*(X2+1)^(.1)).*((X3+1)^(.92)).*((X4+1)^(.7)).*((X5+1)^(-.35))- beta1*((X1+1)^(.64))*(X6+1);
dX(2)= (alpha2*(X2+1)^(.83)).*((X3+1)^(7.4)).*((X4+1)^(5.6)).*((X5+1)^(-2.8))- beta2*((X2+1)^(1.86));
dX(3)= alpha3-beta3*((X1+1)^(.07)).*((X3+1)^(2.6));
dX(4)= alpha4*(X6+1)^(-1.21)-beta4*(X1+1)^(.2).*(X4+1)^2.99;
dX(5)= alpha5*((X1+1)^(1.7)).*((X4+1)^(.56))-beta5*((X5+1)^(2.5));
0 Comments
Answers (0)
See Also
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!