How can I do this integral3?

1 回表示 (過去 30 日間)
Roberto Garcia
Roberto Garcia 2019 年 11 月 13 日
コメント済み: David Goodmanson 2019 年 11 月 15 日
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 件のコメント
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 件)

カテゴリ

Help Center および File ExchangeSpectral Measurements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by