I'm a matlab novice and I need help in setting up an optimisation problem.
I've got 3 Matlab files
- DataArray.m Generates data in a struct array called 'Data'
- CalcSpread.m calculates a single value based on 2 input variables, 'Data' and a scalar, 'd'
- Script.m which just calls the DataArray function and then runs a for loop calling CalcSpread with different values for the parameter 'd' It plots a graph showing d has a minimum.
I want to 'd' that corresponds to the value where the value coming from CalcSpread is a minimum. I want to do this optimisation by modifying ONLY Script.m
Essentially, this is part of a bigger problem but I've simplified it to post here. I don't understand the syntax of how to do this in Matlab.