필터 지우기
필터 지우기

Transcendental equation in two variables

조회 수: 11 (최근 30일)
RAJAT
RAJAT 2023년 12월 27일
댓글: Torsten 2023년 12월 27일
I have a transcendental equation in two variables x and y as (x^2-y^2)*(-y^2+1+0.015*x^4)*xi*besselj(1,xi)+y^2*0.005*besselj(0,xi))-0.0091x^2*y^2*besselj(1,xi)*xi=0, where xi=sqrt(0.041*y^2-x^2), y varies from 0 to 3. I want to solve this equation numerically such that I can get the purely real x, purely imaginary x and complex x. And each type of roots have four or five branches. I tried to solve it using fsolve but I am not getting the solutions separately.
  댓글 수: 1
Torsten
Torsten 2023년 12월 27일
And each type of roots have four or five branches. I tried to solve it using fsolve but I am not getting the solutions separately.
Given a value for y, you expect four or five different solutions for x ? And you don't get them all in one call to fsolve ? Or what exactly do you mean here ?

댓글을 달려면 로그인하십시오.

답변 (1개)

Hassaan
Hassaan 2023년 12월 27일
이동: Torsten 2023년 12월 27일
To run this code in MATLAB:
  1. Save the function in a .m file, for example, complex_root_finding.m.
  2. Execute the function in MATLAB command window by typing complex_root_finding.
This script defines a function complex_trans_eq that computes the real and imaginary parts of the transcendental equation and uses fsolve to find the roots. The results will be printed to the MATLAB command window. The initial guess z0 may need to be adjusted based on the specifics of the equation to ensure proper convergence.
complex_root_finding()
Solutions (x_real, x_imag, y): 0 0 0 0 0 0.0303 0 0 0.0606 0 0 0.0909 0 0 0.1212 0 0 0.1515 0 0 0.1818 0 0 0.2121 0 0 0.2424 0 0 0.2727 0 0 0.3030 0 0 0.3333 0 0 0.3636 0 0 0.3939 0 0 0.4242 0 0 0.4545 0 0 0.4848 0 0 0.5152 0 0 0.5455 0 0 0.5758 0 0 0.6061 0 0 0.6364 0 0 0.6667 0 0 0.6970 0 0 0.7273 0 0 0.7576 0 0 0.7879 0 0 0.8182 0 0 0.8485 0 0 0.8788 0 0 0.9091 0 0 0.9394 0 0 0.9697 0 0 1.0000 0 0 1.0303 0 0 1.0606 0 0 1.0909 0 0 1.1212 0 0 1.1515 0 0 1.1818 0 0 1.2121 0 0 1.2424 0 0 1.2727 0 0 1.3030 0 0 1.3333 0 0 1.3636 0 0 1.3939 0 0 1.4242 0 0 1.4545 0 0 1.4848 0 0 1.5152 0 0 1.5455 0 0 1.5758 0 0 1.6061 0 0 1.6364 0 0 1.6667 0 0 1.6970 0 0 1.7273 0 0 1.7576 0 0 1.7879 0 0 1.8182 0 0 1.8485 0 0 1.8788 0 0 1.9091 0 0 1.9394 0 0 1.9697 0 0 2.0000 0 0 2.0303 0 0 2.0606 0 0 2.0909 0 0 2.1212 0 0 2.1515 0 0 2.1818 0 0 2.2121 0 0 2.2424 0 0 2.2727 0 0 2.3030 0 0 2.3333 0 0 2.3636 0 0 2.3939 0 0 2.4242 0 0 2.4545 0 0 2.4848
function complex_root_finding
% Define the range for y
y_values = linspace(0, 3, 100);
% Store the solutions
solutions = [];
% Options for fsolve
options = optimoptions('fsolve', 'Display', 'none');
% Loop over the range of y values
for y = y_values
% Define the system of equations for real and imaginary parts
fun = @(z) complex_trans_eq(z, y);
% Initial guess: Change this if necessary
z0 = [0, 0];
% Solve the system of equations using fsolve
[z_sol, fval, exitflag] = fsolve(fun, z0, options);
% If a solution is found, store it
if exitflag > 0 % Solution converged
solutions = [solutions; [z_sol, y]];
end
end
% Display the solutions
disp('Solutions (x_real, x_imag, y):');
disp(solutions);
end
function F = complex_trans_eq(z, y)
x_real = z(1);
x_imag = z(2);
x = x_real + 1i * x_imag;
xi = sqrt(0.041*y^4*x^2 - x^2);
% Real part of the function
F_real = real((x^2 - y^2)*(y^2 + 1 + 0.015*x^4)*x*besselj(1, xi) + ...
y^2*0.005*besselj(0, xi) - 0.0091*x^2*y^2*besselj(1, xi));
% Imaginary part of the function
F_imag = imag((x^2 - y^2)*(y^2 + 1 + 0.015*x^4)*x*besselj(1, xi) + ...
y^2*0.005*besselj(0, xi) - 0.0091*x^2*y^2*besselj(1, xi));
% Return a vector of the real and imaginary parts
F = [F_real; F_imag];
end
Code may need to be adjusted as per your needs. Thank you.
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by