user648666
user648666

Reputation: 11

troubles with integration on matlab

I'd like some help please I really need to solve this problem.

Well before anything thank you for your time...

My problem: I have a matrix (826x826 double) and I want to integrate this matrix with respect to a vector of (826x1 double) I don't have the functions of any of this. Is there a command or an algorithm to take the integral of a matrix with respect to a vector? Please I really need help, I'm such a newbie at matlab.

Sincerely. George

Upvotes: 1

Views: 208

Answers (2)

gdvd
gdvd

Reputation: 56

If I understand correctly, you have a matrix Y (size mxn) and a vector X (size mx1) where Y(i, j) = f_j(X(i)) for some unknown function f_j. To approximate the integral of each column over X you could use the trapz function of Matlab which uses the trapezoidal method.

A = trapz(X, Y);

This will integrate Y along its columns using the vector X. If you wanted to integrate along rows you can call the trapz function with an added argument of dim=2. Of course, the dimensions of X and Y must be compatible in either case.

Upvotes: 0

Phonon
Phonon

Reputation: 12737

If it's a constant matrix A integrated with respect to vector x, your answer in simply Ax + c where c is some constant vector. If A is a function of x, you will need to specify exactly what it is. Another case is when both A and x are functions of t. There is no one simple answer and no computer program would do it in most cases. There are books written in this stuff. It's not an easy task.

Upvotes: 1

Related Questions