Question on how to calculate integral
Ältere Kommentare anzeigen
Hello everybody,
I have a question on how to calculate integral of a matrix in Matlab. I have the following code and wants to calculate the integral of A. Do I calculate the integral (area below the curve) correct?
I wanted to calculate the integral from -infinity to +infinity and also -infinity to T....
dt=0.025; %--time step
T=(-30:dt:30)';%(-5:dt:5)'; %-- dimensionless time vector
t=T;
nt=length(T);
T2=9.1093;
A=(exp((-T.^2)/(2*((T2).^2))));
Integral=abs(sum(A))*dt
Thank you!
Antworten (1)
Walter Roberson
am 13 Mai 2017
0 Stimmen
Not exactly: when you do a finite range, you need a correction at the edges. trapz() does the edge correction.
For infinite intervals you should construct an anonymous function and use integral()
Kategorien
Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!