solve numerically a nonlinear (plasma wave dispersion) relation
11 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone,
I'm currently trying to solve numerically the following nonlinear (dispersion) relation (i.e. wave frequency f or pulsation omega, as a function of wave number k_B) with 8 fixed parameters:
that should have 3 solutions (red, light blue and orange curves), according to the following plot:
thus I wrote the following simple code :
Parameters
c = 3e5;
we = 8e4;
wp = 1.3e3;
wc = 3.1e2;
Omegae = -4.4e2;
Omegap = 2.4e-1;
Omegac = 1.3e-2;
uc = 402;
%%Set arrays
k_array = 1e-5:1e-6:1e-2; % k values to solve for
w_array = zeros(length(k_array),1); 3 solutions expected for each k
i = 1; % loop counter
%%Loop over k
for k = k_array(1):k_array(end)
clear w
syms w
eqn = c^2*k^2/w^2 + we^2/(w^2-Omegae^2)...
+wp^2/(w^2-Omegap^2)+(wc^2/w^4)*(w^2+k^2*uc^2)...
+(2*w^2/(wc^2*k^2*uc^2)*(Omegae*we^2/(w^2-Omegae^2)+Omegap*wp^2/(w^2-Omegap^2))^2/...
(1+sqrt(1+4*w^6/(wc^4*k^4*uc^4)*(Omegae*we^2/(w^2-Omegae^2)+Omegap*wp^2/(w^2-Omegap^2))^2))) == 0;
root = vpasolve(eqn,w);
w_array(i,:) = double(root);
i=i+1;
end
but I get the error: Subscripted assignment dimension mismatch, because the solver does not find any solution (empty sym).
Where did I go wrong ?
Thanks for your help. HB
6 件のコメント
David Goodmanson
2018 年 9 月 29 日
Hi Hugo, I can see the units on the plot, but what units are being used in the calculation? 3e5 would seem to imply sec and km.
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!