Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

sum of function handles

$
0
0
Hi, i want to sum two function handle. the functions that i want to sum are following;

   f1=0;
     for i=1:20
          f2=f2(x(1),x(2),x(3))
          f1=f1+f2
     end
how can i do by using function handle? the following is true?

f1=@(x)(0);
for i=1:20
    f2=@(x)(f2(x(1),x(2),x(3)))
    f1=@(x)(f1(x)+ f2(x));
end

Can anyone help me? Because i use this last summation function for fminsearch

Viewing all articles
Browse latest Browse all 19628