İntegral with array boundaries Need help

2 vues (au cours des 30 derniers jours)
sarngon
sarngon le 20 Mar 2015
Hi Guys ,
I want to write a code which includes an array like x=[1 2 3;4 5 6] and
my function is
f=@(y) (y-x).^2
and
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) ,
x=in(:,3:4);
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);
Q(x);
But it didn't work. Am I missing smth ?

Réponses (1)

Mike Hosea
Mike Hosea le 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 .*.

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by