[SOLVED] convert symbolic to handle function and use from fsolve command...

Status
Not open for further replies.

ghasem_008

Full Member level 4
Joined
Feb 9, 2012
Messages
221
Helped
11
Reputation
22
Reaction score
10
Trophy points
1,298
Activity points
2,990
hi.
I have a problem.
my matlab code is very compicated.I want to obtain zeros of a nonlinear equation that involved bessel functions.
I have to slove a coefficient determinant of 4*4.
in all of elements of this determinanT,i have a variable kz that should be specified.

first: i defined a "syms kz" and then wrote my matrix(A).for example:
sysms kz
A11=besselj(0,sqrt(kz^2-5));

second : I want to solve this 4*4 determinant with "fsolve command" in close of my guess.therefore convert symbolic function to handle function with "matlabFunction" command & wrote my new matrix (B).for example:
B11=matlabFunction(A11);

third : with "SAROS" command i found determinant of B matrix and named it :"det_total" .
note that my guess is given.
forth: i wrote "fsolve(det_total,my_guess)"

but i received below error message:

"If FUN is a MATLAB object, it must have an feval method."
Error in ==> mat_function2 at 68
kz(q)=fzero(det_total,my_guess);

how should solve this determinant with handle function.I konw fsolve can't work with symbolic functions.therefore i convert symbolic functions to handle functions with "matlabFunction" command.but yet i receive above error.
please help me.how should i treat?
 

my problem soved.IT WAS VERY SIMPLE:-o

- - - Updated - - -

my problem soved.IT WAS VERY SIMPLE:-o
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…