MATLAB Answers

How can I find the best parameter values to minimize a function

3 views (last 30 days)
Vlad Paul
Vlad Paul on 17 Jul 2019
Commented: David K. on 17 Jul 2019
Hi,
I have an algorithm that does some source separation and as a performance measurement I implemented a Signal to Noise Ratio. At the beginning of the algorithm I initialize parameters like FFT length, hop size, window type and some other source separation parameters. All these parameters can have different values and the separation depends on these numbers.
Is it possible to define a range/vector of values for each parameter (ex. fftLen=[512 1024 2048], window=[hann blackmann hamming] etc.) and run the algorithm to find the best initialization based on a simple Euclidean distance between optimum SNR and estimated SNR? Even though I found some explanations for other problems, I cannot apply these to my algorithm.
Thank you!

  0 Comments

Sign in to comment.

Accepted Answer

David K.
David K. on 17 Jul 2019
If you do not really care about efficiency and time you can just loop through and try everything yourself.
fftlen = [512 1024 2048];
window = {'','',''};
etc
OutputVals = zeros(totalCombinations)
count = 1;
for fftlen
for window
for etc
OutputVals(count) = Algorithm
end
end
end
Analyze_outputs
In general you want to avoid this sort of thing in Matlab as you can often use multidimensional matrices and such. But with no idea what you are actually doing I just wanted to show the most conceptually simple way.

  2 Comments

Vlad Paul
Vlad Paul on 17 Jul 2019
Thank you for the answer. I was thinking about using different for loops, but I know it will take a lot of time. I was thinking of using functions like fminsearch etc., but I am struggling with adapting that function to my need
David K.
David K. on 17 Jul 2019
That is a function included in the optimization app which could make using it easier.
However you would need to turn your algorithm into a function (if it isn't already). But the biggest problem is I do not think it can be given inputs in text. For fftlen it would probably give back some random decimal instead of an exponent of 2.

Sign in to comment.

More Answers (0)

Sign in to answer this question.