correctly use fsolve within a function that's called by fminsearch

2 Ansichten (letzte 30 Tage)
Taresh Patel
Taresh Patel am 22 Apr. 2019
Hey, this is out of some minor desperation So my fminsearch uses initial guesses in a k matrix to call on a function2 that gives a value for error which i wish to minimise. However, function2 uses fsolve, which calls to a third script, function3, which needs to solve for temp and x (i called this var(1X2matrix)). the problem is, in function3, it won't recognise the k values within it. it says not enough input arguments when I put k in the brackets in the function name bit at the top. i.e. the guesses for k do not propogate through to the third script (I think). I've even tried assigning k to an intermediate global variable which can be shared across function2 and function3, but for some reason, the variables wipes in function3 - i know this because i've run the code step by step.

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by