[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
newbie: function of function of function ...
From: |
Dot Deb |
Subject: |
newbie: function of function of function ... |
Date: |
Thu, 27 Sep 2012 21:25:35 +0200 |
Maybe the subject can be misleading but expresses well my confusion.
It is my n-th attempt with octave and every time I try I I get stuck
with some "stupid" problem.
This time I decided to go on and ask for help.
I think the problem is trivial but I just don't see the solution.
I need a funcioin that computes the integral (using something like
quadgk or quadcc) from -Inf to +Inf of an integrand like this:
f(x) * log( f(x) )
where f is the argument of the function
Naively, should read as:
function retval = entropy( f )
quadcc( f*log(f), -Inf, +Inf)
end
I know that, if I define a somewhere function, say "gauss", I can write
f = @(x) -gauss(x) .* log( gauss(x) );
quadcc(f,-Inf,+Inf)
and it gives the right result.
The problem is that I need to include the two lines above in a
function that uses another function name as argument.
And I couldn't sort it out :(
Alberto
- newbie: function of function of function ...,
Dot Deb <=