Question on how to calculate integral
Mostra commenti meno recenti
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!
Risposte (1)
Walter Roberson
il 13 Mag 2017
0 voti
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()
Categorie
Scopri di più su Numerical Integration and Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!