Home >Computer Tutorials >Computer Knowledge >matlab indefinite integral

matlab indefinite integral

王林
王林forward
2024-01-22 17:42:061025browse

matlab indefinite integral

matlab indefinite integral

Equivalent infinitesimal replacement

∵ln(1 x)~x

∴ln[e^sinx ³√(1-cosx)]=ln[1 e^sinx ³√(1-cosx)-1]~e^sinx ³√(1-cosx)-1

∵arctanx~x

∴arctan[2³√(1-cosx)]~2³√(1-cosx)

∴Original formula=(1/2)lim(x→0) [e^sinx ³√(1-cosx)-1]/³√(1-cosx)

=(1/2){lim(x→0) [e^sinx-1]/³√(1-cosx) lim(x→0)³√(1-cosx)/³√(1- cosx)}

=1/2 (1/2)lim(x→0) [e^sinx-1]/³√(1-cosx)

Replace with equivalent infinitesimal value

∵e^x-1~x

∴e^sinx-1~sinx~x

1-cosx~x²/2

∴Original formula=1/2 (1/2)lim(x→0) [e^sinx-1]/³√(1-cosx)

=1/2 (1/2)lim(x→0) x/³√(x²/2)

=1/2 (1/2)lim(x→0) ³√(2x)

=1/2

Try the following numerical integration in matlab where R r is a constant

There are two main problems with the approach of the questioner:

1. The quad function is used to calculate numerical integrals, and the function expression cannot contain symbolic quantities;

2. The expression of the integrand function should be written in a vectorized form about the integrand variable (that is, point arithmetic should be used).

Reference Code:

R=1;

syms L;

rr = 0 : 0.1 : 1;

for ii = 1 : length(rr)

r = rr(ii);

f = @(l)(acos((1 l*l-r*r)/(2*l)) r*r*acos((r*r l*l-1)/(2*r*l) )-0.5*sqrt(4*r*r-(1 r*r-l*l)^2))*2*l/(pi*r^4);

fun = @(L) arrayfun(f,L);

J(ii) = quadl(fun,0,r);

end

plot(rr, J)

Or you can borrow part of the code from Fengxiao 1 upstairs and write:

R=1;

syms L;

rr = 0 : 0.1 : 1;

for ii = 1 : length(rr)

r = rr(ii);

SOA=R^2*acos((R^2 L^2-r^2)/(2*R*L)) r^2*acos((r^2 L^2-R^2) /(2*r*L))-...

0.5*sqrt(4*R^2*r^2-(R^2 r^2-L^2)^2);

PAB=SOA/(pi*r^2);

p=2*L/r^2;

f=PAB*p;

fun = eval(['@(L)' vectorize(f)]);

fun = @(l) arrayfun(@(L)eval(f),l);

J(ii) = quadl(fun,0,r);

end

plot(rr, J)

Although the above code can be run, there is a problem with the integrand - the value of the inverse cosine of the first term of SOA may be a complex number (because when r is slightly smaller, the parameter of acos is greater than 1), please ask the question again Check it carefully.

The above is the detailed content of matlab indefinite integral. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:docexcel.net. If there is any infringement, please contact admin@php.cn delete