Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

1 visualización (últimos 30 días)
John
John el 4 de Ag. de 2015
Cerrada: Stephen23 el 5 de Ag. de 2015
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.

Respuestas (0)

La pregunta está cerrada.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by