Variable in function as well as integral boundary
조회 수: 7 (최근 30일)
이전 댓글 표시
Hi,
I have an integral I want to compute and plot for different angles theta. 0-90 degrees.
For every angle I want to compute the integral of the function from 0 up to the angle theta.
theta = 1:90;
A = 0.4*10^-19;
R = 4215 * theta.^(-1.35)*10^-9;
D_0 = 0.3;
D_c = R.*(1-cosd(theta));
D = (D_0 + D_c)*10^-9;
b = 0.2*10^-6;
Fun = @(theta) (A ./ (6 .* pi .* (D_0 + R .* ( 1-cosd(theta))).^3)) .* b .* R;
F_vdW1 = integral(Fun, 0, theta);
Can someone please help with what I am doing wrong?
Thanks
댓글 수: 0
채택된 답변
Torsten
2022년 10월 22일
편집: Torsten
2022년 10월 22일
Is it this what you want ?
If not, please clarify how the theta in the integrand and in the upper bound of the integral should be interpreted. Mathematically, your notation to use the same name for both is wrong.
theta = 1:90;
A = 0.4*10^-19;
R = 4215 * theta.^(-1.35)*10^-9;
D_0 = 0.3;
D_c = R.*(1-cosd(theta));
D = (D_0 + D_c)*10^-9;
b = 0.2*10^-6;
Fun = (A ./ (6 .* pi .* (D_0 + R .* ( 1-cosd(theta))).^3)) .* b .* R;
F_vdW1 = cumtrapz(theta,Fun);
plot(theta,F_vdW1)
댓글 수: 3
Torsten
2022년 10월 22일
편집: Torsten
2022년 10월 22일
Are you sure that "phi" should enter the equation for R in degrees and not in radians ?
And according to your graphics, only the 6 and not the complete expression 6*pi*[D0+R*(1-cos(phi))]^3 would appear in the denominator of the integrand.
A = 0.4*10^-19;
R = @(phi) 4215 * phi.^(-1.35)*10^-9;
D_0 = 0.3;
D_c = @(phi) R(phi).*(1-cosd(phi));
D = @(phi) (D_0 + D_c(phi))*10^-9;
b = 0.2*10^-6;
Fun = @(phi)(A ./ (6 .* pi .* (D_0 + R(phi) .* ( 1-cosd(phi))).^3)) .* b .* R(phi);
theta = 1:360;
F_vdW1 = arrayfun(@(theta)integral(Fun,0,theta),theta)
plot(theta,F_vdW1)
추가 답변 (1개)
Bruno Luong
2022년 10월 22일
편집: Bruno Luong
2022년 10월 22일
I have no idea if the code correspondons to the formula; I just modify your code to make it work on array
theta = 1:90;
A = 0.4*10^-19;
R = @(theta) 4215 * theta.^(-1.35)*10^-9;
D_0 = 0.3;
D_c = @(theta) R.*(1-cosd(theta));
b = 0.2*10^-6;
Fun = @(theta) (A ./ (6 .* pi .* (D_0 + R(theta) .* ( 1-cosd(theta))).^3)) .* b .* R(theta);
F_vdW1 = arrayfun(@(onetheta) integral(Fun, 0, onetheta), theta)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


