help-octave
[Top][All Lists]

## Re: Indexing functions?

 From: Doug Stewart Subject: Re: Indexing functions? Date: Mon, 9 Oct 2017 09:36:17 -0400

On Mon, Oct 9, 2017 at 8:38 AM, denizyazgac wrote:
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)

What are you trying to do? tell us the overall picture of what you are doing.

curve fitting?
finding a formula?

--
DAS