Transfer Function
Coding
m=10;
k=1;
b=0.5;
num=1;
den=[m,b,k];
Transfer_fun=tf(num,den)
Transfer_function =
1
------------------
10 s^2 + 0.5 s + 1
For unit step Response
Coding
Step(Transfer_function)
…………………………………………………
Output
It is clear from the figure that peak amplitude of output is 1.8
Solving Differential Equation
In Function Body
function dYdt = mechanical_system(t,y)
m = 10;
b = 0.5;
k = 1;
F = 1;
dYdt = [0;0];
dYdt(1) = y(2);
dYdt(2) = F/m-k/m*y(1)-b/m*y(2);
end
In Command Window
x0 = [0,0];
[t,y] = ode45('Q1',[0,150],x0);
plot(t,y);
xlabel('Time');
ylabel('Velocity & Displecement');
title('Time Response to a Force');
Output
It is clear from the figure that peak amplitude of output is 1.8
In Function Body
function dqdt = RC_circuit(t,q)
vin = 5;
R = 100000;
C = 0.000002;
dqdt = vin-(q/(R*C));
end
In Command Window
q0=0;
[t,q]=ode45('RC_circuit',[0,2],q0);
plot(t,q);
xlabel('Time')
ylabel('Velocity')
title('Speed Time Response')
axis([0 1.5 0 1.2]);
Output
Transfer Function
Coding
R=15000;
L=1100*10^(-3);
C=3.3*10^(-6);
num=[1];
den=[L R 1/C];
Transfer_fun=tf(num,den)
Output
Transfer_fun =
1
---------------------------
1.1 s^2 + 15000 s + 3.03e05
Continuous-time transfer function.
For unit step Response
Coding
Step(Transfer_function)
Output
Solving Differential Equation
In Function Body
function dqdt=RLC_circuit(t,q)
vin=10;
r=150;
l=1.01;
c=0.0000033;
dqdt=[0;0];
dqdt(1)=q(2);
dqdt(2)=vin/l-r/l*q(2)-1/(l*c)*q(1);
end
In Command Window
q0=[0;0];
[t,q]=ode45('RLC_circuit',[0,0.20],q0);
plot(t,q);
xlabel('Time')
ylabel('Velocity')
title('Speed Time Response')
Output
SOLUTION USING MODELING
Exercise 1
Exercise 2
Exercise 3