This is my question there is a spring mass damper system.....hit by a step input at t=0 of magnitude 20N for 2 sec.....I know the logic b I dont know how to execute this in ode45
F = Force = 20 for 0<t<2 sec

 採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2021 年 3 月 8 日

0 投票

That's not what I understand a Dirac-pulse to be. This is a 2 second long constant-force push. Implement it as such - on for 2 seconds off after. You do this easiest by dividing the problem into 2 segments - the first 2 s with a constant force and your initial initial conditions, then the remaining 8 s with no force and the end-solution of the first period as initial conditions to the second part. (The ODE-integrating functions are typically sensitive to discrete jumps, that can be handled with the events function, but this piecing-together trick is a KISS-solution. In this case with a discrete jump for the highest derivative you might be fine):
[ta,xa] = ode45(f_with_force,[0 2],[0 0],op); %% initial condition are 0
[tb,xb] = ode45(f_without_force,[2 10],xa(end,:),op); %% initial condition are 0
plot([ta(:);tb(:)],[xa(:,1);xb(:,1)])
HTH

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品

質問済み:

2021 年 3 月 8 日

編集済み:

2021 年 3 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by