Substitute s for jw in a transfer function
조회 수: 48 (최근 30일)
이전 댓글 표시
Hi, I have a transfer function define by
G = ([1 2],[3 4 5]) (as an example)
I want to change the 's' for 'jw'. Does anyone know how to do it?
I've tried subs(G,{s},{1j*omega}) but it didn't work.
댓글 수: 0
채택된 답변
Jon
2021년 1월 11일
Hi,
I think you mean that you define your transfer function using (you forgot the tf() in your example)
G = tf([1 2],[3 4 5]) %(as an example))
Then if you want to evaluate it at a particular frequency, that is a specific value of jw, you can use
w = 3; % for example 3 radians/sec
val = evalfr(G,j*w)
You can also use the freqresp function to evaluate it for multiple values along the jw axis
댓글 수: 6
Walter Roberson
2024년 11월 28일
For 1 x 1 systems, G,
syms omega Omega
EVALFR = subs(poly2sym(G.Numerator{1}, Omega), Omega, 1j*omega) ./ ...
subs(poly2sym(G.Denominator{1}, Omega), Omega, 1j*omega)
Paul
2024년 11월 29일
편집: Paul
2024년 11월 29일
The numeric solution using polyval from this comment should use rdivide, ./, not mrdivide, /, for the general case where w is not a scalar. And safer to use 1j instead of j, which is a common variable name that can shadow the built-in function of the same name
num = [1,2];
den = [3,4,5];
w = [3 4]; % for example 3 and 4 rad/s
val = polyval(num,j*w)/polyval(den,j*w) % wrong
val = polyval(num,1j*w)./polyval(den,1j*w)
추가 답변 (1개)
Pat Gipper
2021년 1월 11일
Matlab uses the reserved constant "i" which is set equal to sqrt(-1). Using your transfer function as defined try the following which will result in the variable "G" which will be a complex number.
num=1*i*w+2;den=3*(i*w)^2+4*i*w+5;G=num/den;
댓글 수: 2
Pat Gipper
2021년 1월 11일
편집: Pat Gipper
2021년 1월 11일
Based on some of your other questions it looks like you don't have access to the Control Systems Toolbox. So you need to do this arithmetic explicitly.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!