필터 지우기
필터 지우기

Input values for ode-solver

조회 수: 3 (최근 30일)
mattzoe
mattzoe 2019년 6월 18일
댓글: Walter Roberson 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