calculating Double integral over a region
5 ビュー (過去 30 日間)
古いコメントを表示
I am trying to plot this double integral but i keep getting an error, can someone help me out thanks.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1205188/image.jpeg)
ymax = @(x) sqrt((9-x.^2)/9);
ymin =@(x) -1.*sqrt((9-x.^2)/9);
fun = @(x,y) aa;
aaa =integral2(fun,-3,3,ymin,ymax);
aa = 2
0 件のコメント
採用された回答
Torsten
2022 年 11 月 24 日
syms x y
int(int(2,y,-sqrt(1-(x/3)^2),sqrt(1-(x/3)^2)),x,-3,3)
1 件のコメント
Carlos Guerrero García
2022 年 11 月 24 日
I think that Torsten answer is better than mine. I was trying to answer the question with minor changes in the original code, but Torsten code is easier and more elegant than mine. +1 to Torsten!!!
その他の回答 (1 件)
Carlos Guerrero García
2022 年 11 月 24 日
When you define "fun", the variable "aa" is undefined yet. Also, because the variables "x" and "y" doesn't appear in the "fun" definition, the compiler provides another error. I suggest (avoiding the usage of the unnecesary declaration of the "aa" value) the following code, resulting the expected numerical value of 6*pi that is two times the area of an ellipse of semiaxes 3 and 1, as expected:
syms x y;
ymax = @(x) sqrt((9-x.^2)/9);
ymin =@(x) -1.*sqrt((9-x.^2)/9);
fun = @(x,y) 2+0*x+0*y; % Avoiding the "aa" declaration and incluing "x" and/or "y" in the function "fun"
aaa =integral2(fun,-3,3,ymin,ymax)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!