Transpose for double integral
이전 댓글 표시
Hello! I'm trying to calculate a double itnegral in MATLAB, and I got help from another person on how to do. This is the code I got from them:
n=1000; m=1000;
a=0; b=1; c=-pi/2; d=pi/2;
f=@(x,y)y.*sin(y+x.*y);
x=linspace(a,b,n+1);
y=linspace(c,d,m+1);
h=(b-a)/n;
k=(d-c)/m;
qv = sum(sum(h.*k.*f(x(1:n)',y(1:m))))
this formula calculates the integral as rectangles. But my question is why we use the transpose? Using the transpose gives the correct answer, but I really don't understand why. I would, of course, ask the person who gave me the code if I could, but unfortunately I can't, and therefor I'm hoping that someone here can help me!:)
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!