how to write fraction function in complex plane by using matlab
조회 수: 29 (최근 30일)
이전 댓글 표시
Hi
I worked in ploting function defined in complex plane by using matlab I know we can write the polynomial in matlab by using its coefficients
for example f(z)= (2-8i)Z^3+(2+3i)Z^2 + (1+5i)Z+ (3-4i) this equation can be written in matlab as p=[(2-8i) (2+3i) (1+5i) (3-4i) ],. But when we find this equation f(z)= (2-8i)/Z^3+(2+3i)/Z^2 + (1+5i)/Z+ (3-4i) how can I write this equation in matlab? I mean here the complex variables in the Denominator
Thanks
댓글 수: 1
Benjamin Thompson
2022년 2월 8일
MATLAB supports complex numbers. See documentation on the topic "complex". Are you trying to write the equation symbolically using the Symbolic Toolbox, or numerically to calculate answers at specific values of Z or to plot over a range of the complex plane?
채택된 답변
John D'Errico
2022년 2월 8일
MATLAB has a simple form to allow you to store only the coefficients of a polynomial. You aready know that. But there is no simple form to allow you to store some arbitrary function. In this case, you wish to store the coefficients of a function that uses inverse powers of a variable Z. Luckily, you can cheat, just a bit. That is, if you have the coefficients as a vector as you do here,
(2-8i)/Z^3+(2+3i)/Z^2 + (1+5i)/Z+ (3-4i)
So you have just the vector:
p = [(2-8i) (2+3i) (1+5i) (3-4i)];
Then you can evaluate it using polyval as:
z = 1:3;
polyval(p,1./z)
That is, we just think of this as a simple polynomial in powers of 1/z, so compute the inverse of z, THEN use polyval on those values.
댓글 수: 5
John D'Errico
2022년 2월 13일
편집: John D'Errico
님. 2022년 2월 13일
I did not ignore two things. I answered the question you asked. You did NOT ask how to find the zeros of a function. You asked how to write what is effectively a polynomial in 1/Z.
My choice of 1:3 is irrelevant, I picked it as an example.
You then say that polyval may not be appropriate. Why not? It evaluates the polynomial that you give it. For example, you gave these coefficients.
format long g
p = [(2-8i) (2+3i) (1+5i) (3-4i)];
z = 1 + 3i;
polyval(p,1./z)
Is that the correct value? Test it.
sum(p.*z.^(-3:1:0))
Note that the above line of code applies ONLY for scalar values of z. However it clearly agrees with polyval.
As far as zeroes goes, please show me where in your question where you EXPLICITLY said even a single word about the zeros of this function? Here is the statement of your question, just in case you forgot:
"I worked in ploting function defined in complex plane by using matlab I know we can write the polynomial in matlab by using its coefficients
for example f(z)= (2-8i)Z^3+(2+3i)Z^2 + (1+5i)Z+ (3-4i) this equation can be written in matlab as p=[(2-8i) (2+3i) (1+5i) (3-4i) ],. But when we find this equation f(z)= (2-8i)/Z^3+(2+3i)/Z^2 + (1+5i)/Z+ (3-4i) how can I write this equation in matlab? I mean here the complex variables in the Denominator:"
That was your exact statement. Yes, you finally added the word zeros in a final comment. Sorry for expressing irritation, but should I be able to read your mind? SIGH. Maybe you were thinking about zeros. But don't tell me that I did not answer the question you asked.
Ok. You want to find the zeros of this function? Still trivial.
proots = 1./roots(p)
Now evaluate the function at those points. I will use polyval.
polyval(p,1./proots)
So zero, to within floating point trash. proots contains the zeros of the indicated polynomial in powers of 1/z.
추가 답변 (1개)
Sphiwe
2023년 10월 15일
num = [1]
den= conv([1 3 5], [1 3], [1 5])
g = tf (num,den)
[z,p,k] = tf2zp(num,den)
pzmap(g)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!