erf and trapezoidal method for volume
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Antworten (1)
Rachana Reddy Mamilla
am 6 Nov. 2018
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.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differential Equations 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!