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.*C2.*(k.^2))+i.*(W-C0.*k)=0
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
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)
See Also
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!