Using fsolve in another fsolve mfile
1 view (last 30 days)
Show older comments
Hello all.
I am dealing with the following function such that:
f(x1(theta), x2(x1(theta))) = 0
where x2 is a (implicit) function of x1.
To solve the above equation, I made a code as follows:
============================================================================
y = fsolve(@(theta) myfun1(theta), x0)
where myfun1 is as follows:
function f = myfun1(theta)
x1 = log(3 * theta ^2 + 2 * theta ^3)
x2 = fsolve(@(x) myfun2(x,x1), x00, x1)
f = x1 + x2 - 10
and, finally, myfunc2 is written as follows:
function g = myfun2(x1)
g = log(x1 + x^2 - 10)
============================================================================
The thing is that I need to use fsolve in another function file that is also using fsolve since x2 is implicitly defined by x1.
However, whenever I run this mfile, then I face the following error message.
============================================================================ Warning: Struct field assignment overwrites a value with class "double". See MATLAB R14SP2 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning, for details. ============================================================================
I strongly suspect that there is a problem in the mfile that uses fsolve twice.
Would you please make a comment on this? I sincerely appreciate all your answers.
Best,
Min
0 Comments
Answers (0)
See Also
Categories
Find more on Surrogate Optimization 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!