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 Commenti

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?
Hi, Mr. Roberson. Thank you for your reply.
Alpha is a parameter of the system. It is calculated as follow, for each time step:
As varies at each time step of the simulation, so does α. U is the velocity of the incoming flow.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Numerical Integration and Differential Equations in Centro assistenza e File Exchange

Richiesto:

il 9 Dic 2020

Commentato:

il 10 Dic 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by