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 .*.
İntegral with array boundaries Need help
3 次查看(过去 30 天)
显示 更早的评论
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 ?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pulsed Waveforms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!