Not getting expected graph. Only straight lines are coming but there should be curve .
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Steven Lord
2020-7-14
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!