Response to an impulse(delta dirac)

6 views (last 30 days)
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

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 8 Mar 2021
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

More Answers (0)

Categories

Find more on Simscape Fluids in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!