フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to convert string to Matlab command line (function)?

1 回表示 (過去 30 日間)
John
John 2015 年 8 月 4 日
閉鎖済み: Stephen23 2015 年 8 月 5 日
We want to make a text line into a function with variable length according to the situation:
functext = '';
for nt =1:N,
functext = sprintf('%s @(c,xdata) sin(c(%d)*xdata+c(%d))',functext,1+2*(nt-1),2*nt);
end
This is to form a funlist with structure as:
funlist = {1, @(c,xdata) sin(c(1)*xdata+c(2)), @(c,xdata) sin(c(3)*xdata+c(4)), @(c,xdata) sin(c(5)*xdata+c(6)) ... };
for use with a very good tool "fminspleas" from "matlab-file-exchange" with a linear summation of a series sinusoidal functions:
y = a0 + a1*sin(c1*x+c2) + a2*sin(c3*x+c4) + a3*sin(c5*x+c6) + ...;
How to convert the functext into funlist? eval? str2fun?
Thanks.
  1 件のコメント
Stephen23
Stephen23 2015 年 8 月 4 日
The function referred to is this one from John D'Errico:

回答 (0 件)

この質問は閉じられています。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by