Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
function integral = leftRectIntegration(f,a,b,n)
|
||||
|
||||
format long;
|
||||
width = (b-a)/n; %calculate the width of each devision
|
||||
x = linspace(a,b,n); %define x-axis
|
||||
integral = width * sum( f(x(1:n-1)) );
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
function integral = rightRectIntegration(f,a,b,n)
|
||||
|
||||
format long;
|
||||
width = (b-a)/n; %calculate the width of each devision
|
||||
x = linspace(a,b,n); %define x-axis
|
||||
integral = width * sum( f(x(2:n)) );
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
function integral = midPointRectIntegration(f,a,b,n)
|
||||
|
||||
format long;
|
||||
width = (b-a)/n; %calculate the width of each devision
|
||||
x = linspace(a,b,n); %define x-axis
|
||||
integral = width * sum( f( (x(1:n-1)+x(2:n))/2 ) );
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
function integral = trapezoidalIntegration(f,a,b,n)
|
||||
|
||||
format long;
|
||||
x = linspace(a,b,n); %define x-axis
|
||||
integral = trapz( x,f(x) );
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
integral = quad(f,a,b,tol)
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
trapezoidalIntegration(@(x)( exp(-(x.^2)) ),0,10,100000)
|
||||
|
||||
ans =
|
||||
|
||||
0.886226925452753
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
quad(@sin,0,pi,1/1000000000000)
|
||||
|
||||
ans =
|
||||
|
||||
2.000000000000000
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
function answer = fermiDirac(x)
|
||||
k = 8.617343e-5; %Boltazmann's Constant in eV/K
|
||||
answer = 1./( 1+exp( (x)/(k*2000) ) ); %Fermi-Dirac distribution with mu = 0 and T = 2000K
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
rightRectIntegration(@fermiDirac,-1,1,1000000)
|
||||
|
||||
ans =
|
||||
|
||||
0.999998006023282
|
||||
Loading…
Add table
Add a link
Reference in a new issue