If Statement In ode45() With Symbolic Variables
이전 댓글 표시
I have the following system of two Second-Order ODEs:
syms q(t) y(t)
structure_oscillator = diff(y,2) == -2 * zeta * diff(y) - y...
+ U(j)^2 / (4 * pi^2 * mass_ratio) * f * (q - 2 * pi * diff(y) / U(j)) +...
U(j)^2 * CFy / (4 * pi^2 * mass_ratio);
where zeta, mass_ratio and f are constants; U is a velocity vector and CFy varies in each time step.
wake_oscillator = diff(q,2) == 2 * beta * ni * diff(q) * (1 - 4 * f^2 / CLo^2 * q^2)...
- ni^2 * q + lambda * diff(y,2) + ni^2 * 2 * pi * diff(y) / U(j);
where beta, ni, CLo and lambda are constants.
I solved these equations with:
[V,S] = odeToVectorField(structure_oscillator, wake_oscillator);
M = matlabFunction(V,'vars',{'t','Y'});
sol = ode45(M,[0 250],[0.01 0 0 0]);
The problem is: CFy is determined by polynomials as function of an angle α. These polynomials varies depending on α (I used spline to fit the curve, and it gaves me 13 breaks). So, for each value of α I need an If to determine which equation to use to calculate CFy.
How can I introduce a If statament to calculate CFy as α varies?
Thank you,
Rafael F.
댓글 수: 2
Walter Roberson
2020년 12월 9일
is alpha effectively constant for any one run, a parameter to the system? or is it something that varies dynamically on external stimulus outside of the current variables? or does it vary dynamically with some of the variables?
Rafael Fehér
2020년 12월 10일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!