Taking away transfer functions

19 次查看(过去 30 天)
Hello.
I am having some issues wonder where i am going wrong. I have 2 transfer functions and one needs to be taken away from the other. When working this out by hand and online maths sites MATLAB is not giving the same answer.
Here is my code
num1 = [-0.2 -5 10];
den1 = [1 0];
tf1 = tf(num1,den1)
num2 = [-0.2 -10 100];
den2 = [1 0];
tf2 = tf(num2,den2)
final = tf2-tf1
It is
((-0.2s^2-5s+10)/s)-((-0.2s^2-10s+100)/s)
by hand this should give me (5s-90)/s but MATLAB is giving me (5s^2-90s)/s^2
Does anyone have any idea where i have gone wrong?
Sorry if it is a simple answer i am still learning.

采纳的回答

Steven Lord
Steven Lord 2023-3-9
by hand this should give me (5s-90)/s but MATLAB is giving me (5s^2-90s)/s^2
Assuming s isn't 0 (in which case evaluating your transfer functions tf1 and tf2 both result in Inf, 10/0 and 100/0 respectively) it's mathematically valid to multiply the result you computed by hand by 1 in the form s/s. If you do that and expand the numerator you'll see that the two results are equivalent.
If the denominators of the two transfer functions were different, to subtract them you'd need to give them the same denominator. One way to do this is to multiply each transfer function by the denominator of the other transfer function in which case the common denominator is the product of the denominators. I suspect you skipped this step in your hand calculations because you knew from inspection that the denominators of both transfer functions were the same and so you just subtracted the numerators. MATLAB didn't skip that step.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by