How can I use "fsolve" for a complex function that is changing in each iteration?

조회 수: 1 (최근 30일)
Ozgur
Ozgur 2017년 6월 14일
답변: Ozgur 2017년 6월 15일
Hi everyone,
I have complex nonlinear function as below:
When used with fsolve, I find a solution for each iteration, but the values seem not right. Here is the code:
clear
clc
load('H.mat');
z0=1+1i;
x1=0.08;
x2=0.06;
c=340;
fr=200:2:6398;
k1=2*pi*fr/c;
options=optimset('TolFun',1e-12,'TolX',1e-12);
for m=1:length(fr);
f=@(z)cos(z*x2)/cos(z*x1)-(Hp1(m)*exp(Hp3(m)));
[z(m),fval(m)]=fsolve(f,z0,options);
end
(Please notice that H is written in polar form and j is included in the phase part to have analytical form for the fsolve)
When inserted in to function, the values are not resulting zero. That seems I have something wrong going on with the complex solution to this problem. Any advises will be welcomed.
Cheers,
Palazzo

답변 (1개)

Ozgur
Ozgur 2017년 6월 15일
Does seperating the equation in to real and imaginary parts make sense in this?
Palazzo

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by