Handling with long function in ode45
이전 댓글 표시
Hi.
I have a problem with operating a long function in ode45:
[t,y] = ode45(@(t,y) [(V^2*A/((p_r(1)*y(1)+p_r(2))*1e-6)-(0.1558*y(1) +89.33)*Ac*(y(1)-Ta))/(m*(p_c(1)*y(1)^2+p_c(2)*y(1)+p_c(3))); -((V^2*A/((p_r(1)*y(1)+p_r(2))*1e-6)-(0.1558*y(1) +89.33)*Ac*(y(1)-Ta))/(m*(p_c(1)*y(1)^2+p_c(2)*y(1)+p_c(3))))*(0.5*ksiM*aA*omega*sin(aA*(y(1)-As)+bA*y(2))*(1/(1+exp(-s*(y(1)-As)))-1/(1+exp(-s*(y(1)-Af))))-theta)/(1+0.5*ksiM*bA*omega*sin(aA*(y(1)-As)+bA*y(2))*(1/(1+exp(-s*(y(1)-As)))-1/(1+exp(-s*(y(1)-Af)))))] , [0 3], [20;0]);
As you can see the function is very long, in fact it is even a system of two. Would it be possible to write a piece of this function, for example:
sin(aA*(y(1)-As)+bA*y(2))
as simple expression, let's say:
f
and use this short expression inside ode45 instead of much longer sine? This would make it much easier for me to operate the function.
Kind regards
Olaf
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!