How can I do this integral3?
Ältere Kommentare anzeigen
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 Kommentare
Star Strider
am 13 Nov. 2019
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
am 13 Nov. 2019
Bearbeitet: Roberto Garcia
am 13 Nov. 2019
Walter Roberson
am 13 Nov. 2019
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
am 13 Nov. 2019
Walter Roberson
am 13 Nov. 2019
(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
am 15 Nov. 2019
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.
Antworten (0)
Kategorien
Mehr zu Calculus finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!