plotting nonlinear equation along real and imaginary axis

I want to plot z along real and imaginary axis. Here, c and p's are constant. r is exp(i*t) with t ranging from (0,2*pi). Any idea will be appreaciated.

 Accepted Answer

Try the following:
  1. Re-arrange the equation so that it is polynomial of complex variable z with coefficients being function of r
  2. for each t
  3. compute r
  4. find the root of the polynomial using roots function (there are two roots for second order polynomial)
  5. save the results: zroot(length(t), 2) [2 for two roots]
  6. end
  7. plot zroot(:, 1) and zroot(2)

3 Comments

I've tried what you've suggested which is below. However nothing results in. Could you please review?
c0=1;c1=1;c2=1;c3=2;c4=1;c5=0;
p5=1;p1=1;p2=1;p3=2;p4=1;
t=0:0.001:2*pi;
for i=1:length(t)
r=exp(1i*t(i));
cz2=c0*(r.^4*p1+r.^3*p2+r.^2*p3+r*p4+p5);
cz=(c0+c1)*r.^4+c2*r.^3+c3*r.^2+c4*r-c5;
f= z.^2.*(cz2)+z.*(cz)+r.^4-r.^5;
froot=roots(f);
zroot=zeros(length(t),2);
end
plot(zroot(:,1))
c0=1; c1=1; c2=1; c3=2; c4=1; c5=0;
p5=1; p1=1; p2=1; p3=2; p4=1;
t=0:0.001:2*pi;
zroot=zeros(length(t),2);
for i=1:length(t)
r=exp(1i*t(i));
cz2 = c0*(r.^4*p1+r.^3*p2+r.^2*p3+r*p4+p5);
cz1 = (c0+c1)*r.^4+c2*r.^3+c3*r.^2+c4*r-c5;
cz0 = r.^4-r.^5;
froot=roots([cz2 cz1 cz0]);
zroot(i,:)=froot;
end
plot(real(zroot(:,1)), imag(zroot(:,1)));
hold on
plot(real(zroot(:,2)), imag(zroot(:,2)));

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Tags

Asked:

on 25 Apr 2022

Commented:

on 26 Apr 2022

Community Treasure Hunt

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

Start Hunting!