Most of the time, we use transfer function to simulate the signal relating to time by using tf() and lsim(). In this paper, I try to use differential equation to solve it.
Main
- Transfer funtion:
0.5 y ˙ + y = F ( t ) 0.5\dot{y}+y=F(t) 0.5y˙+y=F(t) - Input :
F ( t ) = 100 ( t > 0 ) F ( t ) = 75 ( t ≤ 0 ) F(t)=100 \space (t>0) \\ F(t)=75 \space (t\le0) F(t)=100 (t>0)F(t)=75 (t≤0) - matlab code
syms y(t) inp;
ode = 0.5*diff(y,t)+y== inp;
cond = y(0) == 75;
ySol(t,inp) = dsolve(ode, cond);
x=[0:0.1:10];
result=ySol(x,100);
input=x*0+100;
input(1)=75;
plot(x, result);
hold on;
plot(x, input);
legend({'Output','Input'},'Location','southwest');
xlabel('Time')
ylabel('Amplitude')
hold off;
- result 1
ySol(t, inp) =
inp - exp(-2*t)*(inp - 75)
- result 2
Note
- This method is not suitable for second order system practically. I guess primarily because of its complexcity of the differential equation.
- This method is useful for periodic input.