How can I do this integral3?
이전 댓글 표시
I have this integral, how can i print this integral on a plot?
I`ve tried doing this code but console says : "Warning.Reached the maximum number of function evaluations(10000)." So I dont how to solve this.

close all
clear variables
clc
R=1;
rho_s=1;
epsilon0=8.8542*10^-12;
epsilon_r=1;
epsilon=epsilon_r*epsilon0;
phi=pi;
r=3;
n=3;
E0 = (rho_s/(4*pi*epsilon));
Q = linspace(-5,5,50);
v=1;
for theta = linspace(-2*pi,2*pi,50)
dEz = @(theta_prima,phi_prima,r_prima) E0.*r_prima.^(2).*sin(theta_prima).*(sin(theta).* ((r/R)-((r.^2)/(R.^2)).^(2*n)))./(sqrt((r.^2)+ (r_prima.^2) + (2.*r.*r_prima.*((sin(theta).*sin(theta_prima).*cos(phi_prima-phi)) + cos(phi).*cos(theta_prima)))));
Q(v) = integral3(dEz,0,R,0,2*pi,0,pi,'method','tiled');
v=v+1;
end
theta = linspace(-pi,pi,50);
figure(1)
plot(theta,(Q*2*epsilon)/rho_s,'b')
hold on
set(gcf,'PaperType','A4');
xlabel('z');
ylabel('(2*epsilon*E_z)/rho_s');
title('Campo E_z en función de z');
axis([-5 5 -1 1]);
grid on
댓글 수: 6
Star Strider
2019년 11월 13일
Begin by coding it. See the documentation on integral3 to example functions. As written, it appears to produce a single value, so it would plot as a point regardless. If you want to plot it as a function, be specific about which of the variables (
) you want it to a function of.
Roberto Garcia
2019년 11월 13일
편집: Roberto Garcia
2019년 11월 13일
Walter Roberson
2019년 11월 13일
Is it correct that r and R and
and
and φ are constants for the purpose of integration ? And that the variables of integration are
and
and
? And that sen() is sin() ?
and
Roberto Garcia
2019년 11월 13일
Walter Roberson
2019년 11월 13일
(By the way, the inner integral has a closed form. I am still working on the other levels.)
... Oddly as I add more constraints to real-valued, the integral takes longer in Maple.
David Goodmanson
2019년 11월 15일
Hello Roberto,
If it is really true that the numerator contains only unprimed variables as Walter was alluding to, then the factor in square brackets can be taken out of the integral and result is simply the square bracket factor times the potential due to a uniformly charged sphere with charge density rho0. The latter result can be found in most E&M books.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!