How to draw double integral functions

In summary, There are two problems with the posted code - the first being that the function f is not defined properly as a function of R and h, and the second being a missing "." in the definition of the integrand. A corrected version of the code is provided, which should allow the functions to be drawn. However, there may be some warnings due to a singularity in the integral being evaluated.
  • #1
matinking
17
0
Hi every one!

I would like to draw a double integral function in related to R and h parameters by below M-File but It does goes wrong!
Is there anyone to correct it for me?
thank you

syms R h;

a1 = 0;

a2 = atan(R./(R+h));

r1 = h;
r2 = sqrt(R.^2+(R+h).^2);

integrand = @(r,a)(h.*sin(a)/((r.^2).*(r.^2+h.^2-2.*r.*h.*cos(a))));
f = quad2d(integrand,r1,r2,a1,a2);

ezsurf(f,[0.001,5]);
 
Physics news on Phys.org
  • #2
There's two problems that I can see right away (and perhaps more that I don't see). For one I'm guessing you're trying to make f a function of R and h? But you just leave them as symbolic objects. The second problem is that where you define the integrand, you need an extra "."

Code:
integrand = @(r,a)(h.*sin(a)./((r.^2).*(r.^2+h.^2-2.*r.*h.*cos(a))));


If I understand what you're trying to do correctly then this should do it:
Code:
f = @(h,R) quad2d(@(r,a)(h.*sin(a)./((r.^2).*(r.^2+h.^2-2.*r.*h.*cos(a)))),h,sqrt(R.^2+(R+h).^2),0,atan(R./(R+h)));
ezsurf(f,[0.001,5]);

When I ran it, there were a bunch of warnings but I think that may be due to a singularity in the integral you're evaluating.
 
  • #3
Thank you very much.

your correctness let's the functions be drawn!
 

1. What is a double integral function?

A double integral function is a type of mathematical function that involves calculating the area under a two-dimensional curve. It is represented by the symbol ∫∫f(x,y) dA and is used to find the volume, mass, and other properties of objects in space.

2. How do I draw a double integral function?

To draw a double integral function, you first need to understand the limits of integration, which define the boundaries of the area you are trying to calculate. Then, you can use your knowledge of geometry and calculus to determine the shape of the function and plot it on a graph.

3. What is the purpose of drawing a double integral function?

The purpose of drawing a double integral function is to visualize and better understand the mathematical concept behind calculating the area under a curve. It can also be used to solve real-world problems in fields such as physics, engineering, and economics.

4. What are some common mistakes to avoid when drawing a double integral function?

Some common mistakes to avoid when drawing a double integral function include incorrectly setting the limits of integration, not accounting for the correct direction of integration, and forgetting to consider the units of measurement for the area being calculated.

5. Can I use software to draw double integral functions?

Yes, there are many software programs available that can help you draw double integral functions quickly and accurately. Some popular options include WolframAlpha, GeoGebra, and Desmos. However, it is important to have a solid understanding of the mathematical concepts behind double integrals before relying solely on software.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
951
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
997
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
696
  • Special and General Relativity
Replies
5
Views
360
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Atomic and Condensed Matter
Replies
3
Views
866
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
Back
Top