Variable in function as well as integral boundary
Show older comments
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
Accepted Answer
More Answers (1)
Bruno Luong
on 22 Oct 2022
Edited: Bruno Luong
on 22 Oct 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)
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

