# Taking away transfer functions

조회 수: 9(최근 30일)
Matthew 2023년 3월 9일
편집: Walter Roberson 2023년 3월 9일
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 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.

댓글을 달려면 로그인하십시오.

### 범주

Find more on Get Started with MATLAB in Help Center and File Exchange

R2022b

### Community Treasure Hunt

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

Start Hunting!