Make Ode45 return non trivial solution
1 次查看(过去 30 天)
显示 更早的评论
Leonardo Alessandro Cabral Igler
2020-12-3
评论: Leonardo Alessandro Cabral Igler
2020-12-4
Hello there, as the title says: I'm trying to solve a problem of differential equations using ode45. The second order problem is in this code:
Tspan= 0 : 0.01 : 10;
y0=[ 0 ;0 ];
Y=zeros( 4 , numel( Tspan ) );
for ( i=1 : 4)
f= @(t,y) [ y(2); (1/a) * (F(i)*sin(fu*2*pi*t) - b*y(2) - c*y(1) ) ]
[time,answer]=ode45( f, [ Tspan ] , y0 );
Y( i , : ) = answer( : , 1 );
end
So my differential equation problem is: a*ddy+b*dy+c*y=F(i), where ddy is the second derivative and dy is the first derivative.
F is a 4x1 vector, with only one entry. Now the problem is, that ode45 returns agood solution for only one iteration, which is the one where the F entry is not equal to 0. But for the other 3 iterations the solution for y and dy is set to be always 0 at any time. Yes, y=0 solves the equation. But it's not what I hoped to find.
Is there an option for ode45 to just return non trivial solutions?
Thank you
0 个评论
采纳的回答
James Tursa
2020-12-3
If F(i)=0 and y0=0 and dy0=0, then there is no driving acceleration away from the y(t)=0 solution. I.e., y(t)=0 is the solution ... there isn't any "other" solution. If you want other solutions then you need to provide different initial conditions. E.g., maybe small non-zero values of y0 and dy0.
更多回答(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!