How to create a function using the results of the other function (using handle)?

1 回表示 (過去 30 日間)
Hi There,
I have a function with the following form:
Vms = @(n) n(1) .* W.^n(2) .*S.^n(3) ; %W and S are vectors with size [1*165].
I want to obtain another function which contains the following data from Vms:
Vms_mesh = @(x) [x(1:100)+ x(101:165) x(66: 100)];
I thourgh Vms_mesh(Vms); should gave me the results
I need to find the optimation of n later using:
Verror = @(n) sum(Vms_mesh(Vms)- AE_MS_ex ); %AE_MS_ex is experimental vector with size[1*100]
n0 = [3e-3,1,1]; %starting points for searching
minivalue = fminsearch(Verror,n0);
I don't know why but it's not working.
Hope you could help! Thanks!
  3 件のコメント
peipei feng
peipei feng 2020 年 2 月 20 日
Great thanks! it worked! I was so close.
peipei feng
peipei feng 2020 年 2 月 20 日
BTW, do you mind copy your comment to the ANSWER section so I can accept your answer?

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 2 月 20 日
Verror = @(n) sum(Vms_mesh(Vms(n))- AE_MS_ex ); %AE_MS_ex is experimental vector with size[1*100]

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by