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
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
Roberto Garcia 2019 年 11 月 13 日
編集済み: Roberto Garcia 2019 年 11 月 13 日
I know how to produce a single value but how can I plot it like a 2D o 3D graphic ? Thanks.
Walter Roberson
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() ?
Roberto Garcia
Roberto Garcia 2019 年 11 月 13 日
Yeah, r, θ, φ and R are contants. But also wants that for constant values ​​of r and R, the values of θ and φ change between [0,π]
Walter Roberson
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
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 件)

カテゴリ

質問済み:

2019 年 11 月 13 日

コメント済み:

2019 年 11 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by