Why do i get error while converting Block diagram to transfer function?
古いコメントを表示
I have been trying to convert given block diagram to simple transfer function using following code but it is showing error. I am not sure what i am doing wrong. Please help me.


%--------------------------------------------------------------------------
% TASK 1 - Block Diagram Reduction
% Reduce the given Block Diagram
% Given -------------------------------------------------------------------
s = tf('s');
k=1/3*s^0 %assign value 1=1/3
G1 = s;
G2 = k;
G3 = s+2;
%--------------------------------------------------------------------------
% Now we are required to define all the blocks input and output. As shown
% below
G1.u = 'e2';
G1.y = 'ug1';
G2.u = 'ug1';
G2.y = 'ug2';
G3.u = 'ug2';
G3.y = 'ug3';
%--------------------------------------------------------------------------
% Note: Now we are required to relate all these inputs and outputs
%--------------------------------------------------------------------------
sum1 = sumblk('e1','r','y','+-'); % e1 = r - y
sum2 = sumblk('e2','e1','ug3','+-'); % e2 = e1 - ug3
sum3 = sumblk('y','ug1','ug2'); % y = ug1 + ug2
% we have to find the relationship between r and y for our output transfer
% function. ---------------------------------------------------------------
[a, b, c, d] = ss2tf(connect(G1,G2,G3,sum1,sum2,sum3,'r','y'))
[num den] = ss2tf(a,b,c,d)
% Step Response -----------------------------------------------------------
inputTime = [0:.1:10];
inputSignal = ones(size(inputTime));
[outputResp, time] = step(OutputTF);%, inputSignal, inputTime);
subplot(3,1,2);
plot(time,outputResp);
title('Step Response');
xlabel('Time -->');
ylabel('Magnitude -->');
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Transforms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!