getting Not enough input arguments. error while trying to build a transfer function for a MISO system
Show older comments
hi, I am trying to anlyse a system of two inputs and one output and draw a bode plot. the equation is very simple:
G(s)=C*inv(sI-A)*B
while A is a 6*6 matrix C is 2*6 matrix and B is 6*2 matrix:
clc
clear all
syms x1 x2 x3 x4 x5 x6 S G(S) g1 g2 g3 g4 S s
syms E1 E2 C1 C2 C L1 L2 L d1 d2 R
E1=25;
E2=12;
C1=33e-6;
C2=C1;
C=1500e-6;
R=5;
L1=340e-6;
L2=L1;
L=300e-6;
d1=0.293;
d2=0.473;
tspan = [0 0.15];
con=[0 0 0 0 0 0];
f = @(t,x) [(E1+x(4)*(d1-1)+x(5)*(d2-d1)+x(6)*(d2-1))/L1;(E2+x(5)*(d2-1-d1)+x(4)*d1+x(6)*(d2-1))/L2;(d1*x(4)+x(5)*(d2-d1)-x(6)*(1-d2))/L;(-d1*x(3)-d1*x(2)+(1-d1)*x(1))/C1;((1-d2+d1)*x(2)-(d2-d1)*x(1)-(d2-d1)*x(3))/C2;((1-d2)*(x(1)+x(2)+x(3))-x(6)/R)/C];
[t,xa] = ode45(f,tspan,con);
A=[0 ,0 ,0 ,-(1-d1)/L1, (d2-d1)/L1 ,(d2-1)/L1 ;
0 ,0 ,0 ,(d1/L2) ,-(1+d1-d2)/L2 , -(1-d2)/L2 ;
0 ,0 ,0 ,0 ,0 ,-(1-d2)/L ;
(1-d1)/C1 , (-d1/C1) , (-d1/C1) ,0 ,0 ,0;
(d1-d2)/C2 , (1+d1-d2)/C2 , (d1-d2)/C2 , 0, 0, 0;
(1-d2)/C ,(1-d2)/C ,(1-d2)/C , 0, 0, (-1/(R*C))];
B=[(x4-x5)/L1 , (x5+x6)/L1 ;
(x4-x5)/L2 , (x5+x6)/L2 ;
(E1-E2)/L , (E2+x6)/L ;
-(x1+x2+x3)/C1 , 0 ;
(x1+x2+x3)/C2 , -(x1+x2+x3)/C2;
0 , -(x1+x2+x3)/C];
C=[1,0,0,0,0,0;0,0,0,0,0,1];
I=[1,0,0,0,0,0;0,1,0,0,0,0;0,0,1,0,0,0;0,0,0,1,0,0;0,0,0,0,1,0;0,0,0,0,0,1];
G=C*(inv(S*I-A))*B
the results give me a couple of problems. the first one is that I get an odd '\\\r\n' chars in the middle of the tranfer functions and while checking to see what that is I read that it's a bug that occurs when the expretion is too big. I tried to change it with change and replace (I took G(1,1) just for the testing):
newStr = strrep(G(1,1),'\\\r\n' ,'')
but I get an error that said:
Error using strrep
Conversion to double from sym is not possible.
and when I try to get a bode plot of G(1,1) I get this error:
Not enough input arguments.
I tried to delete the weird chars manually by setting a new variables but I still get the same error.
Answers (0)
Categories
Find more on Plot Customization 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!