Different outputs with same inputs

조회 수: 5 (최근 30일)
Paolo De Ciccio
Paolo De Ciccio 2020년 12월 19일
댓글: Paolo De Ciccio 2020년 12월 19일
Hello everyone,
, in
As you can see in image I'm trying to write in different forms a transfer function wich has {10+j, 10-j} poles. I obtained two different expressions, in facts in the 1st case I have {10+j, 10-j} poles, in the 2nd case I have {10, 10} poles, without no imag part.
I also tried an other case: a transfer function wich has {-10+j, -10-j} poles, but in this attempt I multiplyied the imag part with a number very close to 1, and I obtained the desiderd result: {-10+j, -10-j}. I believe that is so strange, so the question is: why I have different outputs with same inputs? It's a bug? Memory management issue? A typo?
My setup is Matlab R2020b, Windows 10 - 64 bit, Ryzen 7 4700U - 8 GB RAM

채택된 답변

Cris LaPierre
Cris LaPierre 2020년 12월 19일
Not sure what the question is, but something is not adding up in your examples. Try clearing your workspace and running your examples again.
s=tf('s');
1/((s+10)^2 +1)
ans = 1 ---------------- s^2 + 20 s + 101 Continuous-time transfer function.
% Your screenshot shows "+100" in the denominator
1/((s+i+10)*(s-i+10))
ans = 1 ---------------- s^2 + 20 s + 101 Continuous-time transfer function.
% Your screenshot shows "+100" in the denominator
1/((s+i-10)*(s-i-10))
ans = 1 ---------------- s^2 - 20 s + 101 Continuous-time transfer function.
If you know your zero, pole, and gain, you can also use that to create your transfer function?
Z = [];
P = [-10-1i -10+1i];
K = 1;
G = zpk(Z,P,K)
G = 1 ----------------- (s^2 + 20s + 101) Continuous-time zero/pole/gain model.
  댓글 수: 12
Cris LaPierre
Cris LaPierre 2020년 12월 19일
Technically yes. You can create custom functions that can be called by your code, but are not variables that appear in the workspace. That is likely not the case with i.
This is a computer program, though, so sometimes clearig the memory or just restarting the program can fix unexpeted behavior.
Recreating your eamples again:
s=tf('s');
i=0;
1/((s+i+10)*(s-i+10))
ans = 1 ---------------- s^2 + 20 s + 100 Continuous-time transfer function.
1/(s+1.00000000001i-10)/(s-1.00000000001i-10)
ans = 1 ---------------- s^2 - 20 s + 101 Continuous-time transfer function.
% Now fix the issue by clearing i
clear i
1/((s+i+10)*(s-i+10))
ans = 1 ---------------- s^2 + 20 s + 101 Continuous-time transfer function.
Paolo De Ciccio
Paolo De Ciccio 2020년 12월 19일
I can accept only one answer, but I appreciated a lot all of yours

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by