How to simulate a simple spring using Simscape
Show older comments
Hello Everyone,
I am using simscape to simulate a simple spring driven by a step input.
I am giving a step input (force) to a spring and then, I want to monitor the Oscillations in spring. I am giving a step input = 1N to the spring (K = 1N/m. Intial deformation =0m). I was expecting the spring to extend to a maximum length of 1m and hold constant there, instead I am seeing Oscillations in the spring extension. I have attached my Simscape file here. Can you help me here?

Answers (1)
SYED IMTIAZ ALI SHAH
on 2 Aug 2019
Edited: SYED IMTIAZ ALI SHAH
on 2 Aug 2019
You don't have any damper in your system, I tried this mathematically and gives me the same result (Oscillation). You must add damper if you want your system to stay at a specific position.
Here is the mathematical model for your system with and without damper.
>> n = [1] ;
>> d = [1 0 1];
>> fn = tf(n,d)
fn =
1
-------
s^2 + 1
Continuous-time transfer function.
>> t = 0:0.1:10;
>> wref = zeros(1,length(t));
>> wref(1:length(t)) = 1;
>> [y,t] = lsim(wref,fn,t);
>> plot(t,y)

After adding damper
d = [1 1 1]; % rest of the code remain the same

Here is the modified Simscape model (Damper value is kept 1,rest of the parameters are exactly the same as provided by you)

Categories
Find more on Assembly 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!