I Have problems with the function ss2tf, matlab say me: Undefined function 'max' for input arguments of type 'sym'.

9 views (last 30 days)
I want obtain the transfer function with the matrix A,B,C,D but I have problems. I don´t know if this problem is by my matlab R2013a, because in other matlab version 2011 works well. Thanks
  2 Comments
Alejandra
Alejandra on 27 Jun 2014
Edited: Star Strider on 27 Jun 2014
clf;close all;clc;clear all;format short
%%Variables Simbolicas
syms x1 x2 x3 V g K M R L
%%Sistema de Ecuaciones
F1=x2;
F2=g-(K*x3^2)/(M*x1);
F3=(V/L)-((R*x3)/L);
F=[F1;F2;F3]
%%variables de estado
X=[x1;x2;x3];
%%Puntos de equilibrio del sistema
Xe=solve(F,x1,x2,x3);
disp('Los puntos de equilibrio del sistema son:')
Pe=[Xe.x1 Xe.x2 Xe.x3]
%Entrada
Pv=[V];
%Parametros del Sistema
Pf=[M;K;L;g;R];
%%valores de parametros
M=0.05;
K=0.0001;
L=0.01;
R=1;
g=9.81;
V=7;
%
PD=[V;M;K;L;g;R];
Pe=subs(Pe,[Pv;Pf],PD);
%%salidas del sistema
G=X(1);
%%linealizacion
Ao=jacobian(F,X);
A=subs(Ao,[X;Pv;Pf],[Pe';PD]);
E=eig(A)
%
Bo=jacobian(F,Pv);
B=subs(Bo,[X;Pv;Pf],[Pe';PD]);
%
Co=jacobian(G,X);
C=subs(Co,[X;Pv;Pf],[Pe';PD]);
%
Do=jacobian(G,Pv);
D=subs(Do,[X;Pv;Pf],[Pe';PD]);
[num,den]=ss2tf(A,B,C,D) %HERE IS THE PROBLEM
max=double(max)
%num=[-1962/7];
FT=tf(num,den)
pzmap(FT)
figure(2)
step(FT)
axis([0 0.4 -2 0.4])
xlabel('t')
ylabel('Altura del Balón')

Sign in to comment.

Answers (1)

Arkadiy Turevskiy
Arkadiy Turevskiy on 7 Jul 2014
The first problem with your code is that A,B,C,and D matrices are symbolic, but you re trying to use ss2tf function that works on numeric matrices.
If you don't mind the loss of symbolic nature of your matrices, you can convert them to numeric:
A=double(A);
B=double(B);
C=double(C);
D=double(D);
Then your calculations should work

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!