step function code for 2 input 1 output control system with delay

7 ビュー (過去 30 日間)
amal moharam
amal moharam 2020 年 4 月 21 日
コメント済み: Ameer Hamza 2020 年 4 月 21 日
I am working on control system with 2 input and 1 output. I write a code to calculate transfer function1 due to input 1 and transfer function2 due to input 2.
My question is how to combine these two transfer function to calculate step function.Also how to use tranfer function with delay. Can anyone help me please.
I use matlab 2015.
%%% My code and the errors descriptions
tf1=feedback(G,H)); %input1
tf2=Gd/(1+G*H); %input2
% I try to use tfdata ,
[ntf1,dtf1] = tfdata(tf1)
[ntf2,dtf2] = tfdata(tf2)
Numerator = {ntf1 ntf2} ;%Numerators of u_1 and u_2
Denominator = {dtf1 dtf2}; %Denominators of u_1 and u_2
y = tf(Numerator,Denominator) %creates a transfer functionfor both inputs
step(y)
%1- This error appeared
Error using tf (line 287 (start with y))
{The values of the "num" and "den" properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing
numeric data. }
%Also another error appeared when I try to use tranfer function with input delay
G=tf(num,den,'inputdelay',1); %with delay
%2-This error appeared
{Error using DynamicSystem/tfdata (line 62 (start with tf data))
State-space models with internal delays cannot be converted to transfer function form.}

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 4 月 21 日
編集済み: Ameer Hamza 2020 年 4 月 21 日
try this
G = tf(1, [1 2 3]);
H = tf([1 2], [1 2 3]);
tf1 = feedback(G, H);
tf2 = G/(1+G*H);
Numerator = [G.Numerator H.Numerator];
Denominator = [G.Denominator H.Denominator];
y = tf(Numerator,Denominator);
step(y)
I couldn't recreate the 2nd error. Can you share the values of num and den when that error occurs?
  2 件のコメント
amal moharam
amal moharam 2020 年 4 月 21 日
thank you for your reply.
Numerator = [G.Numerator H.Numerator] ;%Numerators of u_1 and u_2
Denominator = [G.Denominator H.Denominator]; %Denominators of u_1 and u_2
I can't understand the answer well. If you mean that I write Num & den for transer function by hand , I need the code to read them automatically because I do iterations and transfer function change while compilation .
Ameer Hamza
Ameer Hamza 2020 年 4 月 21 日
The comments in the code were not mine, and I just copied your code. I have removed them now.
No, in these lines
Numerator = [G.Numerator H.Numerator];
Denominator = [G.Denominator H.Denominator];
you don't need to write the numerator and denominator yourself. They will be automatically extracted from the transfer function.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by