numerical integraion with array limits
18 views (last 30 days)
I am trying to work out the integrals that are function of one of the limits, and both limits are vectors:
As a and b must be scalars, so integral won’t work here. Someone suggested using arrayfun in the answers to a similar question in April where only one limit is a vector, how to do this?
Mike Hosea on 6 Dec 2013
Edited: Mike Hosea on 6 Dec 2013
Assuming you want each individual integral to be
Qab = @(aj,bj)integral(@(x)lognpdf(bj-x,2,1),aj,bj)
Q = arrayfun(Qab,a,b)
You don't have to rename a and b in Qab, as they are "scoped" to be distinct from the previously defined a and b vectors, but I just did it for clarity.
More Answers (1)
Sergio Quesada on 1 Jun 2018
Edited: Sergio Quesada on 1 Jun 2018
Hi everybody, I'm working on a similar easier case, but with no success... I'm trying to evaluate
liminf=ones(1,20); syms x;
beeing 'a' an escalar, and 'r' also a 1x20 array. That is, 20 different integrals from 1 to each value of 'r'
Error using integral (line 85)
A and B must be floating-point scalars.
Thankyou so much !!