Need help/suggestions finding optimization parameters

1 次查看(过去 30 天)
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by