Need help/suggestions finding optimization parameters

1 view (last 30 days)
I have a large vector of data that I'm performing calculations on. My calculation is dependent on the state of a leading and lagging moving average. I'm trying to find a maximum value based on moving average periods. A very simple example:
data = [big vector];
[lead,lag] = movavg(data,M,N,'e');
for M = 1:1000
for N = 1:1000
[lead,lag] = movavg(data,M,N,'e');
for i = 1:size(data)
if lead(i) > lag(i)
data(i) = data(i)-1;
else
data(i) = data(i)+1;
end
end % end N
end % end M
Instead of the 2 M,N 'for' loops I've converted the values to a matrix (trying to avoid 'for' loops). I'm interested in using an algorithm to find the best M,N combination. I would appreciate any suggestions or examples that might be able to help me out.
Thank you!
I would like to expand my M/N parameters but the # of iterations takes a long time.

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!