Not getting expected graph. Only straight lines are coming but there should be curve .
2 views (last 30 days)
Show older comments
Dhananjay Singh
on 14 Jul 2020
Answered: Steven Lord
on 14 Jul 2020
clc
tspan = (0:0.25:100);
y0 = [1376000000,10,0];
[t,y] = ode45(@(t,y)[-3.6*10^-9*y(1)*y(2)+0*y(3);-3.6*10^-9*y(1)*y(2)-0.5*y(2);0.5*y(2)-0*y(3)],tspan,y0);
plot(t,y(:,1),'b',t,y(:,2),'r',t,y(:,3),'g')
0 Comments
Accepted Answer
Steven Lord
on 14 Jul 2020
The values of the first component of the solution are so much larger in magnitude than the others that even if they did vary (which they do at first before settling down into what looks to be a steady state after about t = 2 or t = 3) it would be like trying to see one Lego block on the ground from the window of an airplane cruising at 30,000 feet.
If you plot the three components separately you can see the variation at the start.
figure
subplot(3, 1, 1);
plot(t, y(:, 1), 'b');
subplot(3, 1, 2);
plot(t, y(:, 2), 'r');
subplot(3, 1, 3);
plot(t, y(:, 3), 'g')
0 Comments
More Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations 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!