Subscript no. 1 is out of range. Error when using tf command?

8 vues (au cours des 30 derniers jours)
David
David le 1 Déc 2014
I am trying to compute a transfer function from a state space I calculated using the reg() function. Here is the code:
%% Setup clear;clc;close all a = [-0.0558 0.9968 0.0802 0.0415; 0.598 0.115 0.0318 0; -3.05 0.388 0.465 0; 0 0.0805 1 0]; b = [0.00729; -0.475; 0.153; 0]; c = [0 0 0 1]; d = [0]; sys = ss(a,b,c,d) Aircraft = tf(sys) nRA = [10]; dRA = [1 10]; Rudder_Actuator = tf(nRA,dRA) nWF = (1/3)*[1 0]; dWF = (1/3)*[3 1]; Washout_Filter = tf(nWF,dWF)
num = (Rudder_Actuator*Aircraft*Washout_Filter); den = (1+(Washout_Filter*Rudder_Actuator*Aircraft)); tf = minreal(tf(num,den)); Transfer_Funk = tf % insert epic bass Nummys = [0.3825 -0.664 4.46 0]; % numerator coefficients of Transfer_Funk Dennys = [1 9.809 -2.426 -4.835 3.526 1.27 -0.07644]; % denominator coefficients [A1,B1,C1,D1] = tf2ss(Nummys,Dennys); sys1 = ss(A1,B1,C1,D1) %% 1) p_feed = [-0.0051 -0.468 -0.279+0.628i -0.279-0.628i -1.106 -9.89]; Feed_Gain = place(A1,B1,p_feed) Fixed_Feed_Gain = transpose(Feed_Gain); %% 2) p_Control = [-0.0253 -2.34 -1.39+3.14i -1.39-3.14i -5.53 -49.5]; Observe_Gain = place(A1,B1,p_Control) Fixed_Observe_Gain = transpose(Observe_Gain); %% 3) Compensator_Sys = reg(sys1,Feed_Gain,Fixed_Observe_Gain) A2 = [-60.18 -575.3 -2451 -6587 -7728 -191.1; 1 0 -9.731 16.89 -113.5 0; 0 1 -9.356 16.24 -109.1 0; 0 0 -1.687 4.665 -31.33 0; 0 0 -0.4593 1.797 -5.355 0; 0 0 -0.03395 0.05894 0.6041 0]; B2 = [2.218;25.44;24.46;7.025;1.201;0.08877]; C2 = [-50.37 -577.7 -2455 -6585 -771 -191.2]; D2 = [0]; % These values come from the Compensator_Sys state matricies
disp('The transfer function of the compensator is') [Nummers,Denners]=ss2tf(A2,B2,C2,D2); Gc = tf(Nummers,Denners)
Everything works until I try to create the transfer function from the state space. It says: Error using InputOutputModel/subsref (line 44) Subscript no. 1 is out of range. Error in MEM355 (line 48) Gc = tf(Nummers,Denners)
Any ideas how I can fix this?

Réponses (2)

Juan Gomez
Juan Gomez le 22 Nov 2017
make sure that you have all of your equation in rule, i had the same problem because i didn't put a (*) for multiply 2 arguments

Image Analyst
Image Analyst le 5 Déc 2014
Make sure Nummers doesn't exceed the max value for the first dimension. What does this say
whos tf
whos Nummers

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by