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!

 Respuesta aceptada

Star Strider
Star Strider el 6 de Abr. de 2021

0 votos

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.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Abr. de 2021

Respondida:

el 6 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by