Input values for ode-solver

2 次查看(过去 30 天)
mattzoe
mattzoe 2019-6-18
Hello everyone, I'm trying to solve an equation with the ode45-solver.
My problem is, that I don't know how to import the values from the variables Theta_D, Theta_p_D and Q_E_D into the function script. Those variables are calculated in the script and they are row-vectors. The calculation of those variables is complex and is omitted here
My function is:
function sdot = DGL_Getriebe(t,s)
sdot = [s(2);
(Q_E_D - 0.5 * Theta_p_D * s(2)^2) / Theta_D];
end
And my script is:
Theta_D = cell2mat(Theta);
Theta_p_D = cell2mat(Theta_p);
Q_E_D = cell2mat(Q_E);
t_span = [0 10];
q0 = [0 0];
[t, state_value] = ode45(@(t,s) DGL_Getriebe(q,s), t_span, q0);
q_an = state_value(:,1);
q_dot = state_value(:,2);
% Plots
Best regards!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by