How to numerically integrate two vectors in 2012a
이전 댓글 표시
Bold = edit I've been trying to integrate two vectors t & a each with approx 100 values. I need to integrate c(T) = int a(t) dt between T and 0.
----edit----
I have two vectors a, and t. I need a vector answer c. each vector has aprox 100 values, and i need c to have this amount of answers too
c(T) = integral of a(b) with respect to t (dt), between T and 0. (T>0)
And i need c(T) to be in vector form. I've tried trapz, but this only gives me a single value. And i cant use the 'quad', or 'intergral' function, as i do not have an imput function. (Or cannot figure out how to create a function for this that works).
I am getting my a, and t, values from another function. Each t value corresponds to each a value.
댓글 수: 3
per isakson
2012년 12월 16일
'::' is not known by Matlab
Image Analyst
2012년 12월 16일
Should we assume T is less than 0, T is greater than 0, or must it be able to handle both?
Chris
2012년 12월 16일
채택된 답변
추가 답변 (2개)
per isakson
2012년 12월 16일
See
quad
Numerically evaluate integral, adaptive Simpson quadrature
댓글 수: 1
John D'Errico
2012년 12월 16일
No! Quad is not the tool to do numerical integration of data vectors. Use trapz instead.
Image Analyst
2012년 12월 16일
Here's what my help for int says:
int
--- help for filtstates.int ---
int Convert a FILTSTATES.CIC object to an integer matrix.
int(Hs) returns an signed integer matrix for the FILTSTATES.CIC
object.
EXAMPLE:
Hm = mfilt.cicdecim;
hs = Hm.states; % Returns a FILTSTATES.CIC object
states = int(hs); % Convert object to a signed integer matrix.
See also
FILTSTATES/CIC.
Obviously not what you want. Depending on how you define integrate, you can use sum() or trapz().
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!