Tuna EREN
Tuna EREN

Reputation: 25

MATLAB Error using fzero

y = @(Er) i*sqrt((((w^2*Mr*(Er))/isik_hizi^2)-(2*pi/lamdac)^2));
y0 = i* sqrt((w/isik_hizi)^2-(2*pi/lamdac)^2);
yansima = @(Er) ((y0/m0)-(y(Er)/m))/((y0/m0)+(y(Er)/m));
T = @(Er) exp(-y(Er)*l);
fx = @(Er) (s11*s22-s21*s12-(exp(-2*y0)*(la-l))*((T(Er)^2)-(yansima(Er)^2))/(1-(yansima(Er)^2*T(Er)^2)))
cozum = fzero(@(Er) fx(Er),5.72+7.21*i)

s11,s12,s21,s22 and other parameters complex. Function is fx. fx have Er. Er is symbol. First Er value 5.72+7.21i . I am looking for new value close to the first Er. But I have problem;

Error using fzero (line 307) Function value at starting guess must be finite and real.

Error in s0308 (line 76) cozum = fzero(@(Er) fx(Er),5.72+7.21*i)

Upvotes: 0

Views: 673

Answers (1)

shinde
shinde

Reputation: 5

A quick search for documentation of fzero, tells that you can only use a real number as initial guess input argument, so fzero won't be working for complex numbers as in your case.

Upvotes: 0

Related Questions