double integral and fitted functions

3 views (last 30 days)
Daniel
Daniel on 9 Jul 2013
Hi guys,
I have two fitted functions a(t)and b(t). Both via splines. I need to compute an integral:
integral(func,0,1)
where func=a(u)*integral(b(t),0,u).
I know that I can do integrate(cf,0,1) for a fitted object. But how can I compute a double integral?
Thanks.
Daniel.

Answers (1)

Mike Hosea
Mike Hosea on 9 Jul 2013
I'm going to treat this like a homework problem. You'll need to define some anonymous functions. For example, if b is a pp-form, you can create a function that evaluates b by
bfun = @(x)ppval(b,x);
and
bint = @(u)integral(bfun,0,u);
Then you can build up to the point where you can define func. There's more to know, e.g. about "vectorizing" bint with ARRAYFUN before using it, or choosing the 'Arrayvalued' option in the outer integral. You can find some threads on that. But first you need to get started by understanding how to define anonymous functions in MATLAB.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!