Input values for ode-solver
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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!
Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!