m=10kg, c=0.4Ns/m, k=4Nm(Mass-Spring-Damper System)

General solution, Natural response, Step response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
syms x y;
u=dsolve('D2y+0.04*Dy+0.4*y=0','x')
U=dsolve('D2y+0.04*Dy+0.4*y=0','y(0)=1','Dy(0)=1','x');
subs_U=subs(U,x,0:0.1:250);
t=0:0.1:250;
plot_U=double(subs_U);
plot(t,plot_U)
hold on

figure
num=[1];
den=[10 0.4 4];
h=tf(num, den);
step(h)
Read more »

Transfer Function

tf?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
>> help tf
tf - Transfer function model

Use tf to create real-valued or complex-valued transfer function models, or to
convert dynamic system models to transfer function form.

sys = tf(numerator,denominator)
sys = tf(numerator,denominator,ts)
sys = tf(numerator,denominator,ltiSys)
sys = tf(m)
sys = tf(___,Name,Value)
sys = tf(ltiSys)
sys = tf(ltiSys,component)
s = tf('s')
z = tf('z',ts)
Read more »

Mass-Spring-Damper System

1
2
3
4
5
6
7
8
9
10
11
h=tf([1 4],[1 4 40])
pole(h)
zero(h)
figure
step(h)

h1=tf([10 40],[1 4 40])
pole(h1)
zero(h1)
figure
step(h1)
Read more »

Bar Plots

1
2
3
x = -2.9:0.2:2.9;
y = exp(-x.*x);
bar(x,y)

Stairstep Plots

1
2
3
x = 0:0.25:10;
y = sin(x);
stairs(x, y)
Read more »