Computing the double integral of a surface
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Andromeda
am 30 Okt. 2021
Kommentiert: Andromeda
am 30 Okt. 2021
I am trying to compute the double integral of a surface but I keep getting the error "First input argument must be a function handle." and I do not understand what that means. How can I get around this error? See attached picture below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/784183/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 30 Okt. 2021
Like this
syms x y
z = @(x,y) x.^2 + y.^2;
surface_int = integral2(z,1,2,4,9);
disp(surface_int)
3 Kommentare
Alan Stevens
am 30 Okt. 2021
The @(x,y) is Matlab's way of defining an in-line function of x and y (rather than having z(x,y) as you might find in other programs).
The .^, rather than just ^ indicates raise to the power element by element if x (or y) is more than a single scalar value when the function is called. Since integral2 calls the function, z, with a matrix of values, .^ is needed.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Function Creation 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!