Borrar filtros
Borrar filtros

why the 0.1 is a high require in f2 line

1 visualización (últimos 30 días)
JICHAO ZHANG
JICHAO ZHANG el 20 de Jun. de 2023
Comentada: JICHAO ZHANG el 20 de Jun. de 2023
f = @(r,theta,phi,xi) r.^3 .* sin(theta).^2 .* sin(phi);
f1=@(theta,phi,xi)integral(@(r)f(r,theta,phi,xi),0,2,'ArrayValued',1);
df2=@(theta,phi,xi)cell2mat(arrayfun(@(theta,phi,xi)f1(theta,phi,xi),theta,phi,xi,'UniformOutput',0));
f2=integral3(@(theta,phi,xi)f(theta,phi,xi),0,pi,0,pi,0,2*pi,'AbsTol', 0,'RelTol',0.1);
ret=f2
  1 comentario
Walter Roberson
Walter Roberson el 20 de Jun. de 2023
f = @(r,theta,phi,xi) r.^3 .* sin(theta).^2 .* sin(phi);
So f expects 4 input parameters
f2=integral3(@(theta,phi,xi)f(theta,phi,xi),0,pi,0,pi,0,2*pi,'AbsTol', 0,'RelTol',0.1);
but here f is invoked with three input parameters

Iniciar sesión para comentar.

Respuestas (1)

Naman
Naman el 20 de Jun. de 2023
Hi Jichao Zhang,
The 'RelTol' parameter in the integral3 function sets the relative error tolerance for the numerical integration.
In the given code, 'RelTol' is set to 0.1, which allows for a maximum relative error of 10% in the numerical integration. This value is relatively high and may not be appropriate for some applications that require high accuracy. However, depending on the specific requirements of the application, a 'RelTol' of 0.1 may be sufficient to achieve reasonable accuracy while still maintaining computational efficiency.
Hope it helps.

Categorías

Más información sobre Numerical Integration and Differentiation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by