Tried solving the following complex equation for W varying values of k from 0.1 to 100 and plot the positive imaginary part of the solution (W) against k. Got wrong roots using roots command : S.*((W.^2)​-(C1+C2).*​W.*k+C1.*C​2.*(k.^2))​+i.*(W-C0.​*k)=0

1 view (last 30 days)
C1=2 C2=1 C0=2.5 S=2.18e-7 for k=0.1:1:100 C(1)=S; C(2)=(-S.*(C1+C2).*k+i); C(3)=(S.*C1.*C2.*k3-i.*C0.*k); r=roots(C) imagr=imag(r) maxr=max(imagr) plot(k,maxr) end

Accepted Answer

Mischa Kim
Mischa Kim on 18 Apr 2014
Edited: Mischa Kim on 18 Apr 2014
Alexey, use
C1 = 2; C2 = 2.5; C0 = 0; S = 2.18e-7;
k = 0.1:1:100;
for ii = 1:numel(k)
C(1)= S;
C(2)= -S*(C1+C2)*k(ii) + 1i;
C(3)= S*C1*C2*k(ii)^2 - 1i*C0*k(ii);
r = roots(C);
imagr = imag(r);
maxr(ii) = max(imagr);
end
plot(k,maxr)
Note: I have not double-checked the coefficients.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!