step function code for 2 input 1 output control system with delay
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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.}
0 comentarios
Respuestas (1)
Ameer Hamza
el 21 de Abr. de 2020
Editada: Ameer Hamza
el 21 de Abr. de 2020
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 comentarios
Ameer Hamza
el 21 de Abr. de 2020
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.
Ver también
Categorías
Más información sobre Dynamic System Models en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!