Transfer function display works in command window but not published file
Mostrar comentarios más antiguos
Hello,
I just ran my script file for my transfer function and it worked out just fine in the command window, now when I publish I get an error
syms T Tj I Fj Tj_in
V = 50; % cm^3
R = .05; % ohms
Vj = 30; % cm^3
DeltaH = 15000; % J/C
cp = 2.7778e-4; % Wh/g K
cp_f = 9.7694e-4; % Wh/g K
U = 12.5e-4; % W/cm^2 K
Area = 30; % cm^2
rho = 1.8; % g/cm^3
rho_f = 1.07; % g/cm^3
x = [Tj T];
u = [I Fj Tj_in];
y = x;
f1 = Fj/Vj*(Tj_in-Tj)+(U*Area/(rho_f*cp_f*Vj))*(T-Tj);
f2 = I^2*R/(rho*cp*V)+I*DeltaH*exp(-4000/(273+T))-(U*Area/(rho*cp*V))*(T-Tj);
dx = [f1; f2];
A = jacobian(dx,x);
B = jacobian(dx,u);
C = jacobian(y,x);
D = jacobian(y,u);
Fj_ss = 108; % cm^3/hr
I_ss = 3; % A
Tj_in_ss = 25; % C
T_ss = 46.93; % C
Tj_ss = 30.47; % C
A_substitute = subs(A,{Fj,I,Tj_in,T,Tj},{Fj_ss,I_ss,Tj_in_ss,T_ss,Tj_ss});
B_substitute = subs(B,{Fj,I,Tj_in,T,Tj},{Fj_ss,I_ss,Tj_in_ss,T_ss,Tj_ss});
Anum = eval(A_substitute);
Bnum = eval(B_substitute);
Cnum = eval(C);
Dnum = eval(D);
% State Space Model
sys = ss(Anum,Bnum,Cnum,Dnum)
%%part d
tf = tf(sys)
tf =
From input 1 to output...
14.42
1: ---------------------
s^2 + 6.289 s + 5.369
12.06 s + 57.82
2: ---------------------
s^2 + 6.289 s + 5.369
From input 2 to output...
-0.1823 s - 0.2723
1: ---------------------
s^2 + 6.289 s + 5.369
-0.2735
2: ---------------------
s^2 + 6.289 s + 5.369
From input 3 to output...
3.6 s + 5.376
1: ---------------------
s^2 + 6.289 s + 5.369
5.4
2: ---------------------
s^2 + 6.289 s + 5.369
Continuous-time transfer function.
But now I go into my published file and this comes up
Error using InputOutputModel/subsref (line 44)
Use two or more subscripts to index into MIMO models or model arrays, as in the "sys(2,1)" command.
Error in HW06_Tu_Hamlin_R (line 83)
tf = tf(sys)
And whenever I run that section with the tf (part d), I get the error
Error using InputOutputModel/subsref (line 44)
Use two or more subscripts to index into MIMO models or
model arrays, as in the "sys(2,1)" command.
Why did it work when I clear all contents and run it, but will not work after the first run?
1 comentario
Rick
el 7 de Oct. de 2015
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!