조회 수: 4(최근 30일)
Ioannis Saravanos 2021년 11월 10일
댓글: Ioannis Saravanos 2021년 11월 10일
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표시숨기기 이전 댓글 수: 1
Ioannis Saravanos 2021년 11월 10일
Gc_a is the response of the system. So im trying to define everything meaning control, disturbance and process to get the plot

댓글을 달려면 로그인하십시오.

### 채택된 답변

VBBV 2021년 11월 10일
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
Gc_a = From input 1 to output: 2.083 exp(-3*s) * ----------- s^2 + 0.1 s From input 2 to output: 1.562 exp(-4*s) * ----------- s^2 + 0.1 s From input 3 to output: 1.25 exp(-5*s) * ----------- s^2 + 0.1 s From input 4 to output: 1.042 exp(-6*s) * ----------- s^2 + 0.1 s From input 5 to output: 0.8929 exp(-7*s) * ----------- s^2 + 0.1 s From input 6 to output: 0.7812 exp(-8*s) * ----------- s^2 + 0.1 s From input 7 to output: 0.6944 exp(-9*s) * ----------- s^2 + 0.1 s Continuous-time transfer function.
apply the transfer function to convert coefficients from statespace
##### 댓글 수: 1표시숨기기 없음
Ioannis Saravanos 2021년 11월 10일
Gc_a = tf(1,KK); Is this correct to create a transfer function with 1 in the numerator divided by KK factor in the denominator?

댓글을 달려면 로그인하십시오.

### 추가 답변(1개)

KSSV 2021년 11월 10일
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
##### 댓글 수: 1표시숨기기 없음
Ioannis Saravanos 2021년 11월 10일
This produces ss

댓글을 달려면 로그인하십시오.

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by