Fminsearch in a for loop

3 次查看(过去 30 天)
Hi there, I am trying to minimise the difference between two vectors using fminsearch. I have managed to do this using the code atttached however the variable 'beta_hold' and 'rate' in this sample code are just 1 vector from two 12x12 arrays. I need to somehow loop over the below code for every 'rate' and 'beta_hold' in the 12x12 array but I can't seem to figure out how to use a loop within multiple functions. If anyone could help with this or point me in the right direction that would be appreicated!

采纳的回答

Star Strider
Star Strider 2021-4-6
The code borders on being indeciperable.
Do not use global variables. See Passing Extra Parameters for the correct way to pass information to functions.
I have no idea what you’re doing or what you want the code to do. If you want to compare individual rows or columns, see the documentation section on Matrix Indexing to understand how to select them. It is then straightforward to loop through the matrices.

更多回答(0 个)

类别

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

标签

Community Treasure Hunt

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

Start Hunting!

Translated by