Using fsolve in another fsolve mfile

2 次查看(过去 30 天)
Minhyeon
Minhyeon 2014-3-16
编辑: Minhyeon 2014-3-16
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 个)

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by