필터 지우기
필터 지우기

erf and trapezoidal method for volume

조회 수: 1 (최근 30일)
HoboHarry
HoboHarry 2018년 10월 27일
답변: Rachana Reddy Mamilla 2018년 11월 6일
trying to determine volume for the following Y=5(1-erf(x) for x=0:1 Y=0 for X=1:29 Y=5(1-erf(3x+25) for x=29:30 Using the trapezoidal method. Have the following code but am completely stuck. Any hints please?? h is intervals and x is above. Currently when i run it there is no volume being spat out for the 0-1 range (haven't got any further) so not even sure where to go for the 1:29 and >29 values
y = @(x) 5*(1-erf(x));
X0 = 0;
X30 = 1;
Xn = 4;
h = ((X30-X0)/Xn);
Area = 0;
while (X0<X30)
Area = Area+(h/2)*(y(X0)+y(X0+h));
X0 = X0+h;
end

답변 (1개)

Rachana Reddy Mamilla
Rachana Reddy Mamilla 2018년 11월 6일
erf:
It is an Error function. Y = erf(X) is the error function for each element of X. X must be real. The error function is defined as:
erf(x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt.
Trapezoidal method:
Trapezoidal method is a popular method for numerical integration of various functions. This method is mainly applicable to estimate the area under a curve by splitting the entire area into a number of trapeziums of known area.
You are also creating a function handle , splitting the area under your function into finite trapezoids[4 in number] and then finding the cumulative area of all the trapezoids.
This way you can just find the area under each y and not the volume using this method. Hope this link would be helpful to you.

카테고리

Help CenterFile Exchange에서 Error Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by