error using ss2tf function
19 views (last 30 days)
Show older comments
clear all;
clc;
%% Declaration with parameter
I = 205113.07; % kg-m^2
m= 15118.35; % kg
c = 3.511; % m
rho = 1.225; % kg/m^3
Tm = 49817.6; % N
S = 37.16; % m^2
%% Equation of motion(Longitudinal modes)
syms alpha etta delta theta q V
f1 = ((etta*Tm*cos(alpha))/m) - ((0.5*rho*(V^2)*S*((0.0013*alpha^2)-(0.00438*alpha)+0.1423))./m)-(9.81*sin(theta-alpha));
f2 = q-(etta*Tm*sin(alpha)/(m*V))-(0.5*rho*V*S*((0.0751*alpha)+(0.0144*delta)+0.732)/m)+(9.81*cos(theta-alpha)/V);
f3 = (0.5*rho*V^2*S*c*(-0.00437*alpha-0.0196*delta-0.123*q-0.1885)/I);
f4 = q;
%% Linearization
A = jacobian([f1,f2,f3,f4],[V alpha q theta]);
B = jacobian([f1,f2,f3,f4],[etta delta]);
%% Equillibrium
V = 94.5077; %m/s
etta = 0.58;
delta = -0.1678; %rad
theta = 0;
alpha = 0;
q = 0;
%% Evaluate System and Control Matrix
format shortG;
fprintf("State Matrix = ");
A = eval(A)
fprintf("Control Matrix = ");
B = eval(B)
I want to convert State Space to Single input Single Output Transfer function Transfer function but I get error when using ss2tf function.
can any one help me out?
0 Comments
Answers (1)
Paul
on 14 Feb 2022
Define the nonlinear output equation y = h(x,u), take the jacobians wrt x and u, and evaluate them at the equilibirium point. These results will be C and D. Same exact approach to derive A and B from xdot = f(x,u). Once you have C and D then if you really need the transfer function using ss2tf()
[n,q]=ss2tf(A,B,C,D)
or better
hzpk = zpk(ss(A,B,C,D))
Or just leave the model in state space form
hss = ss(A,B,C,D);
unless you have to have the explicit transfer function for some reason.
5 Comments
Paul
on 14 Feb 2022
It looks like the output vector y = [v; alpha; q; theta] is exactly the same as the state variable vector, x. In this case, what should C and D be in this equation, where u = [etta; delta]?
y = C*x + D*u
Once you have C and D you can get all eight transfer functions at once using the second or third method in my comment above.
If sst2tf must be used, you can use
[num,den] = sst2tf(A,B,C,D,1)
to get the first four transfer functions and
[num,den] = sst2tf(A,B,C,D,2)
to get the second four transfer functions.
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!