How to evaluate parameters in sum() of handle functions with fminsearch
Ältere Kommentare anzeigen
I have some problems with the evaluation of parameters in a sum of handle functions
x_exp and y_exp are known vectors.
I want to evaluate the parameters in the following function:
The idea is to use fminsearch to evaluate g(i) and t(i): ObjFunc=@(g,t)sum((y_exp-y_eq(x))^2/(y_exp^2))
Looking in the community, I tried to use:
x_exp=rand(1,10); %just to define the known vectors
y_exp=rand(1,10);
n=3;
g=rand(1,n);
t=rand(1,n);
syms x i
y_eq = matlabFunction( symsum(g.*exp(-x_eq./t), i, 1, n));
My question is: "How can I evaluate g(i) and t(i)?
Thank you in advance
2 Kommentare
John D'Errico
am 24 Okt. 2021
Bearbeitet: John D'Errico
am 24 Okt. 2021
This is a question I see often, where somene feels they need to introduce symbolic parameters. When there is no reason to use a symbolic expression, DON'T! That you don't know the value of something does not mean it must be symbolic. And, as soon as you make things symbolic, you make MATLAB run MUCH more slowly.
As you can see in the answer you got, no symbolic parameters needed to be created or involved.
3Nz0
am 24 Okt. 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Mathematics finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!