xy+y^5+3=0 My input is real x, from this implicit equation y will have both real and imag values for each x I want to plot a 3 D plot where z will represent imag y. Pleasehelp

조회 수: 1 (최근 30일)
Basically I want to plot a 3 D graph in which x axis will represent input values of x,, yaxis will represent real values of y and z axis wil represent imaginary values of y. As output Y will have both real and imaginary values
  댓글 수: 2
Torsten
Torsten 2023년 5월 23일
편집: Torsten 2023년 5월 23일
You'll get 5 solutions for y given a value for x. Maybe 4 of these solutions for y have real and imaginary parts different from 0.
E.g. for x = x1 you may get
y1 = c1
y2 = c2r + 1i*c2i
y3 = c2r - 1i*c2i
y4 = c3r + 1i*c3i
y5 = c3r - 1i*c3i
where the c's are real numbers.
I can't understand what you want to plot here.
Dyuman Joshi
Dyuman Joshi 2023년 5월 23일
For each x, there will be 5 corresponding y values. How do you want to plot that?
x=rand;
roots([1 0 0 0 x 3])
ans =
1.0278 + 0.7884i 1.0278 - 0.7884i -0.4376 + 1.1503i -0.4376 - 1.1503i -1.1805 + 0.0000i

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

채택된 답변

John D'Errico
John D'Errico 2023년 5월 23일
편집: John D'Errico 2023년 5월 23일
Simple enough. Just do exactly what you asked. Remember the roots of a 5th degree polynomial will in general have no algebraic solution, so we need to call roots.
I used a loop here, since roots is not vectorized, and although I could have written more sophisticated code that would do it all in one line, the code would be impossible to read.
nx = 100;
x = linspace(-10,10,nx)';
ysol = zeros(nx,5);
for n = 1:nx;
ysol(n,:) = roots([1 0 0 0 x(n) 3]).';
end
plot3(repmat(x,1,5),real(ysol),imag(ysol),'.')
grid on
box on
The color changes along those curves represents where two roots essentially switched branches. Remember that roots does not know in which order to return the roots, so we can see some confusion in the plot.
  댓글 수: 5
Dyuman Joshi
Dyuman Joshi 2023년 12월 15일
How do you want to arrange the complex roots? By their magnitude? Real values? Imaginary values?
RAJAT
RAJAT 2023년 12월 15일
I want to arrange by real values....sorry for late reply,,thanks for help

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by