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!