Variable in function as well as integral boundary
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Paul Heineman
am 22 Okt. 2022
Kommentiert: Paul Heineman
am 22 Okt. 2022
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 Kommentare
Akzeptierte Antwort
Torsten
am 22 Okt. 2022
Bearbeitet: Torsten
am 22 Okt. 2022
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 Kommentare
Torsten
am 22 Okt. 2022
Bearbeitet: Torsten
am 22 Okt. 2022
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)
Weitere Antworten (1)
Bruno Luong
am 22 Okt. 2022
Bearbeitet: Bruno Luong
am 22 Okt. 2022
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 Kommentare
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


