Divide transfer function get "Model I/O dimensions must agree." Please help
12 views (last 30 days)
Show older comments
Ioannis Saravanos
on 10 Nov 2021
Commented: Ioannis Saravanos
on 10 Nov 2021
clc;
clear;
num1 = {1, 1, 1, 1, 1, 1, 1};
num2 = {-4, -4, -4, -4, -4, -4, -4};
den1 = {[10 1], [10 1], [10 1], [10 1], [10 1], [10 1], [10 1]};
den2 = {[15 1], [15 1], [15 1], [15 1], [15 1], [15 1], [15 1]};
Gp= tf(num1,den1, 'IODelay', [3 4 5 6 7 8 9]);
Gp = minreal(Gp);
Gd= tf(num2,den2, 'IODelay', [3 4 5 6 7 8 9]);
Gd = minreal(Gd);
a=(3:1:9);
kc=(5./(0.8.*a));
Ti=10;
s = tf('s');
Gc = kc*(1/(1/10*s));
Gc=minreal(Gc);
Gc_a = (Gc*Gp)/(1+(Gc*Gp)); %y/SP
Hello all, this is my code. However when I run it every single * or / gets an error message of Model I/O dimensions must agree. Any help here?
2 Comments
Paul
on 10 Nov 2021
I only see one error on the last line
num1 = {1, 1, 1, 1, 1, 1, 1};
num2 = {-4, -4, -4, -4, -4, -4, -4};
den1 = {[10 1], [10 1], [10 1], [10 1], [10 1], [10 1], [10 1]};
den2 = {[15 1], [15 1], [15 1], [15 1], [15 1], [15 1], [15 1]};
Gp= tf(num1,den1, 'IODelay', [3 4 5 6 7 8 9]);
Gp = minreal(Gp);
Gd= tf(num2,den2, 'IODelay', [3 4 5 6 7 8 9]);
Gd = minreal(Gd);
a=(3:1:9);
kc=(5./(0.8.*a));
Ti=10;
s = tf('s');
Gc = kc*(1/(1/10*s));
Gc=minreal(Gc);
Gc_a = (Gc*Gp)/(1+(Gc*Gp)); %y/SP
This error arises becsue Gc and Gp are both 1x7 tf matrices. Can't mutiply a 1 x 7 with another 1 x 7.
What exactly are you trying to accomplish?
Accepted Answer
VBBV
on 10 Nov 2021
clc;
clear;
num1 = {1, 1, 1, 1, 1, 1, 1};
num2 = {-4, -4, -4, -4, -4, -4, -4};
den1 = {[10 1], [10 1], [10 1], [10 1], [10 1], [10 1], [10 1]};
den2 = {[15 1], [15 1], [15 1], [15 1], [15 1], [15 1], [15 1]};
Gp= tf(num1,den1, 'IODelay', [3 4 5 6 7 8 9]);
Gp = minreal(Gp);
Gd= tf(num2,den2, 'IODelay', [3 4 5 6 7 8 9]);
Gd = minreal(Gd);
a=(3:1:9);
kc=(5./(0.8.*a));
Ti=10;
s = tf('s');
Gc = kc*(1/(1/10*s));
Gc=minreal(Gc);
K = Gc.*Gp;
KK = ((1+(Gc.*Gp))); % auxiliary variable
Gc_a = tf(Gc.*Gp,KK) %apply the transfer function to convert coefficients from statespace
apply the transfer function to convert coefficients from statespace
More Answers (1)
KSSV
on 10 Nov 2021
May be you can run a loop for each tf..
for i = 1:7
Gc_a(i) = (Gc(i)*Gp(i))/(1+(Gc(i)*Gp(i))); %y/SP
end
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!