How to make a double integration with numerical integration?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Rertan Ertan
am 18 Jun. 2020
Beantwortet: Bjorn Gustavsson
am 18 Jun. 2020
I wrote this code, but it didn't work and got message "Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check
for mismatched delimiters."
f = @(sigma, y, yp) exp(-(y-yp).^2 ./ sigma.^2);
for i = 1:N
for j = 1:N
A(i,j) = integral(@(y),(integral @(yp)f(sigma,y,yp),yp1(j),yp(j)),y1(i),y2(i));
end
end
0 Kommentare
Akzeptierte Antwort
Bjorn Gustavsson
am 18 Jun. 2020
Why not use integral2 to integrate over 2-D domains - it can handle, at least, boundaries in the y-direction that are functions of x. Or you if this is your function that you want to integrate you should be able to do at least one integration symbolically and end up with a function that is built with some erf (error-function) terms.
HTH
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Error Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!