## using the transfer function for further calculation

### Eliraz Nahum (view profile)

on 8 Dec 2018
hey
I extracted the transfer function from my state space definition.
now I want to multiply it (transfer function) with my (converted to lalplace) input and get an expression, which will be converted to the time zone (with the ilaplace function). unfortunately I can do nothing with the expression that I get from G=tf(sys). I am attaching the code I wrote and the 2 last rows make troubles...
clear all
close all
clc
syms t u G Y %creating symbolic variable
%defining the ODE that describes the physical behaviour of the system
a=[6,5,1]; %creating a vector that represents the Input function derivatives coefficients - [a0,a1,...,an-1,...,a0] - 6y+5y'+y''
b=[15,0,0]; %creating a vector that represents the Output function derivatives coefficients - [b0,b1,...,bn-1,...,b0] - 15u+0u'+0u''
ode_order=length(a)-1; %determines the system order
u=2*(t^0);
%creating the matrices of the space state y''=-(a1/a2)*y'-(a0/a2)*y+(b0/a0)*u
%X=[x1,x2]=[y,y'] and X'=[x1',x2']=[y',y'']=[x2,-(a0/a2)*x1-(a1/a2)*x2+(b0/a0)*u]
A=zeros(ode_order,ode_order);
for k=[1:1:(ode_order-1)]
A(k,k+1)=1;
end
for k=[1:1:ode_order]
A(ode_order,k)=-(a(k)/a(ode_order+1));
end
B=zeros(ode_order,1);
B(ode_order,1)=b(1);
C=zeros(1,ode_order);
C(1,1)=1;
D=zeros(1,1);
%DEFINING OUR SYSTEM IN TERMS OF STATE SPACE
sys=ss(A,B,C,D);
%FINDING OUR SYSTEM TRANSFER FUNCTION
G=tf(sys)
Y=G*laplace(u);
ilaplace(Y)