Response to an impulse(delta dirac)

3 次查看(过去 30 天)
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
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 个)

类别

Help CenterFile Exchange 中查找有关 Simscape Fluids 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by