フィルターのクリア

Using Fminsearch to Minimize Data difference

3 ビュー (過去 30 日間)
Suki Sule
Suki Sule 2016 年 2 月 25 日
コメント済み: Star Strider 2016 年 2 月 26 日
I need to create a function that can be passed to fminsearch. I want to get argmink =||ak-d||^2, where a is a time series output ie x,y (amplitude/time) and d is another different time series output signal. I need to find the value of k that will cause convergence or give the minimum difference value between a and d. So I want to use fminsearch to do this. Some pointer will be very useful. Thanks.

回答 (1 件)

Star Strider
Star Strider 2016 年 2 月 26 日
If I understand correctly what you want to do, this works:
d = randi(9, 10, 1); % Create Data
a = randi(9, 10, 1); % Create Data
argmin_k = @(k) norm(a*k-d).^2; % ‘argmin’ Function
[k,normval] = fminsearch(argmin_k, 1);
  3 件のコメント
Suki Sule
Suki Sule 2016 年 2 月 26 日
Or do I have to run fminsearch separately for each parameter, f(k1) then f(k2)...f(kn)
Star Strider
Star Strider 2016 年 2 月 26 日
Thank you!
I am not certain what you want to do. For ‘k’ to be a vector, ‘k’ would have to be the same length as ‘a’ and ‘d’, and you would then use element-wise multiplication (.*) in your ‘argmin_k’ function.
The code changes to:
d = randi(9, 10, 1); % Create Data
a = randi(9, 10, 1); % Create Data
argmin_k = @(k) norm(a.*k-d).^2; % ‘argmin’ Function
K0 = ones(size(d)); % Vector ‘k’ Is The Same Length As The Data Vectors
[k,normval] = fminsearch(argmin_k, K0);

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSurrogate Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by