How to find all the numerical solutions of a nonpolynomial equation by using "vpasolve"
1 view (last 30 days)
Show older comments
Hi,
I am solving a nonpolynomial equation, and "vpasolve" keeps returns no solution or zero solutions.
With a given value of "w1", I would like to solve the complex value of "alpha1".
The expected solution of "alpha1" is:
when " w1= 0 - 4 " ,
"alpha1" should be about "0.1-0.1i" to "5-5i".
My question is, if there is
(1) Any way to find all the solution "vpasolve" find, rather than only the first solution it returns.
(2) Any other way to solve this equation?
clc
clear
%Input the values of constant variables:
S=0.1; delta=0.1; U1=0; m=1; R=1; R0=(1-delta)*R; U_j0=20;
omega=1:0.01:4;
%Solve this "eqn1" in terms of "alpha1"
syms alpha1
for j=1:301
w1=omega(j)*(R-R0)/U_j0;
eqn1=delta*besselk(m, alpha1/delta)*(U1*alpha1 - alpha1*(w1/alpha1) + S*delta*m)^2*(2*S*m + (- S^2*delta^2*m^2 + 2*S^2*delta^2 + 2*S^2*delta + 2*S*alpha1*(w1/alpha1)*delta*m - 2*S*alpha1*delta*m - alpha1^2*(w1/alpha1)^2 + 2*alpha1^2*(w1/alpha1) - alpha1^2)/(delta*(alpha1 - alpha1*(w1/alpha1) + S*delta*m)*((log(1 - delta)*(m^2 - 2))/m^2 + (2*(log(alpha1*(w1/alpha1) - alpha1 - S*delta*m) - log(delta))*(S^2*m^2 + 2*S*alpha1*(w1/alpha1)*m - 2*S*alpha1*m - alpha1^2*(w1/alpha1)^2 + 2*alpha1^2*(w1/alpha1) - alpha1^2))/(m^2*(alpha1 + S*m - alpha1*(w1/alpha1))^2) - (2*S*(m - alpha1 + alpha1*(w1/alpha1)))/(m*(alpha1 + S*m - alpha1*(w1/alpha1))^2) - (alpha1*besseli(m, alpha1*(1/delta - 1))*((w1/alpha1) - 1))/(S*m*besseli(m, alpha1*(1/delta - 1)) - R*alpha1*(besseli(m - 1, alpha1*(1/delta - 1))/2 + besseli(m + 1, alpha1*(1/delta - 1))/2)*((w1/alpha1) - 1)*(delta - 1)) - (2*(log(-alpha1*((w1/alpha1) - 1)*(delta - 1)) - log(delta))*(S^2*m^2 + 2*S*alpha1*(w1/alpha1)*m - 2*S*alpha1*m - alpha1^2*(w1/alpha1)^2 + 2*alpha1^2*(w1/alpha1) - alpha1^2))/(m^2*(alpha1 + S*m - alpha1*(w1/alpha1))^2) + (2*S*alpha1^2*((w1/alpha1) - 1)*(delta - 1)*(S*m - alpha1 + alpha1*(w1/alpha1)))/(m*(alpha1 + S*m - alpha1*(w1/alpha1))^2*(alpha1 - alpha1*(w1/alpha1) + S*delta*m)))) - (S*m*(delta - 1))/delta) - R*(besselk(m - 1, alpha1/delta)/2 + besselk(m + 1, alpha1/delta)/2)*(alpha1 - alpha1*(w1/alpha1) + S*delta*m)*(- S^2*delta^2*m^2 + 2*S^2*delta^2 + 2*S^2*delta + 2*S*alpha1*(w1/alpha1)*delta*m - 2*S*alpha1*delta*m - alpha1^2*(w1/alpha1)^2 + 2*alpha1^2*(w1/alpha1) - alpha1^2) == 0;
sol2=vpasolve(eqn1,alpha1,[-1-1i, 10-10i]);
sol_x2(1:length(sol2),j)=double(sol2);
end
figure
plot (omega,real(sol_x2(1,:)))
xlabel('\omega')
ylabel('Real part of \alpha^*_r')
grid on
figure
plot (omega,imag(sol_x2(1,:)))
xlabel('\omega')
ylabel('Imaginary part of \alpha^*_i')
grid on
Thanks for your time. Any help would be appreciate it !
0 Comments
Answers (1)
Saarthak Gupta
on 28 Nov 2023
Hi Lu,
I understand you wish to obtain multiple solutions to the given nonpolynomial equation, numerically.
For polynomial equations, ‘vpasolve’ returns all solutions. For nonpolynomial equations, however, there is no general method of finding all solutions and ‘vpasolve’ returns only one solution by default.
To find multiple solutions to the nonpolynomial equation, you can set ‘Random’ parameter to true and use ‘vpasolve’ repeatedly. Optionally you may specify a search range for the variable (‘alpha1’ in your case).
When you set ‘Random’ to true, random initial guesses are chosen for the variable. If you specify a search range, guesses are uniformly chosen within the range, otherwise guesses are generated using a Cauchy distribution with a half-width of 100.
Please refer to the following MATLAB documentation for further reference:
0 Comments
See Also
Categories
Find more on Bessel functions 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!