help-octave
[Top][All Lists]

Re: Indexing functions?

 From: denizyazgac Subject: Re: Indexing functions? Date: Mon, 9 Oct 2017 05:38:54 -0700 (MST)

```Thanks !
I also write as cell

x=1:1:10;
for index=1:1:length(x);
f{index}=@(y) y*x(index).^2;
end

But problem is, I always give some value to y.
But I want to obtain functions like
f(1)= Y*1^2
f(2)=Y*2^2
f(3)=Y*3^2
because I will also make some substraction from experimental data for *each
f* and use that sum of differences for differential evaluation.
So I should cover Y unknown till the end for optimisation. Main parameter is
Y.

So, there should be a cost function like

x=1:1:10;
for index=1:1:length(x);
f{index}=@(y) y*x(index).^2;
end

x=1:1:10;
for jindex=1:1:length(x);
cost_fun_array{jindex}=@(Y) abs(*f{jindex}*-exp_data(jindex))
%%But I can not call f{jindex} beacause Octave push me to give a value to Y;
in that case I can not carry on optimisation

cost_fun=sum(cost_fun_array)

--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

```