İntegral with array boundaries Need help
3 views (last 30 days)
Hi Guys ,
I want to write a code which includes an array like x=[1 2 3;4 5 6] and
my function is
Q= integral ( f,0,x);
* *I couldn't be successful about it and I need help how can I take an integral over array boundries like this.* *
Thanks. One of members told me to try below command Qscalarx but it dint work for me. I tried it like below (scalar) ,
Qscalarx = @(x)integral(@(w) kr*(in(:,3:4)-w)*(k*l*vi/(wr*ccons))*(((1+p*l)*vi/ccons).^(k-1))*2.71.^((-((1+p*l)*vi/ccons)).^k),0,x);
Q = @(x)arrayfun(Qscalarx,x);
But it didn't work. Am I missing smth ?
Mike Hosea on 22 Mar 2015
I've answered this question in a follow-up comment on the other question. It will work, but you have to debug your code. You were supposed to substitute x for in(:,3:4) in the integrand. Since p is a function of w, you'll need to use p(w) everywhere, and some of your multiplications will need to be changed from matrix multiplication * to element-wise array multiplication .*.