Constant in a transfer function
Ältere Kommentare anzeigen
I have the transfer function
z + b
-----------------
z^2 - 1.5 z + 0.7
I want to write this to matlab so :
global b
h=tf([1 b],[1 -1.5 0.7],1)
However Matlab returns
1
-----------------
z^2 - 1.5 z + 0.7
How can I define it so that I can get the right answer?
1 Kommentar
Maria San Juan
am 7 Jan. 2020
Hi! I had moreorless the same issue but with a plotting. After a few tries, this is the code I came up with. Not sure if can help you but maybe it´d help others in the future.
In my case, the exercise asked me to plot the response of a system to a step by changing the gain K from 0 to 5, 20 times. I mean, 20 "jumps" from 0 to 5. sys1 y sys2 were in serie while Hs was meant for the feeback.
s = tf('s');
Kvec= linspace(1,5,20);
t=0:0.1:10;
figure; hold on;
for i=1:20
k= Kvec(i);
sys1= k/s;
sys2= 10/(s*s +2*s+10);
Hs=1/(s+2);
Gs= sys1*sys2;
Ms= (Gs*Hs)/(1+Gs*Hs);
step(t,Ms);
end
By putting the "calculation" of the system within the for, I had no problems with declarating k because it took a value in each loop. And step works with tf butat the begining I tried declaring syms s k failing miserably. So by this way I relsolved the syms and the giving values to k problems.
Hope it helped somehow.
PS: Spanish girl, sorry for the mistakes. English is my second language.
Akzeptierte Antwort
Weitere Antworten (2)
Paulo Silva
am 23 Jan. 2011
The tf function doesn't support what you want (I'm not 100% sure, someone could correct me), you must define the b value before passing it to tf, I tried using symbolic values and it didn't work, what you can do is define a constant value for b and compare the response to usual input signals like the step and impulse, you can even use bode(h) and see the diferences.
clear clf clc figh=figure(1); axh1=subplot(2,1,1,'Parent',figh); hold(axh1,'on'); axh2=subplot(2,1,2,'Parent',figh); hold(axh2,'on'); for b=1:5 h=tf([1 b],[1 -1.5 0.7],1); step(axh1,h) impulse(axh2,h) end legend(axh1,'b=1','b=2','b=3','b=4','b=5') legend(axh2,'b=1','b=2','b=3','b=4','b=5')
Elias
am 23 Jan. 2011
0 Stimmen
1 Kommentar
Paulo Silva
am 23 Jan. 2011
b must be obtained experimentally or calculated using some textbook formulas, I'm sure you can find the formulas and examples on these books
Franklin G.F., Powell J.D., Workman M.L., “Digital Control of Dynamic Systems”, 3rd Edition, Addison-Wesley, 1998.
K. J. Astrom, and H. Winttenmark, “Computer-controlled systems: theory and design”, 3ª ed., Prentice-Hall, 1998.
K. Ogata, “Discrete Time Control Systems”, Prentice-Hall, 1994.
Kategorien
Mehr zu Time-Domain Analysis finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!