Talha
Talha

Reputation: 33

How to implement the following integral in Matlab

I am using Matlab to compute the following integral:

enter image description here

I want to know what is the best method to do this integral(trapez ...ect), and how to write it down.

this formula is called . The Integral of Time multiply Absolute Error (ITAE).

where epsilon is the error vector, and t is a vector that has been generated as follow

t = 0 : 0.0001 : 10

here both epsilon and t have the same size.

Upvotes: 1

Views: 379

Answers (2)

Rotem
Rotem

Reputation: 32084

Example using trapz:

t = 0 : 0.0001 : 10;
epsilon = sin(t*3 - pi/6).*exp(-0.2*t); %Example for epsilon
ITAE = trapz(t, t.*abs(epsilon))

Result:

ITAE =

    9.4006

Upvotes: 1

AnakinJ
AnakinJ

Reputation: 36

Have you tried t*epsilon'? Where the " x' " means transposition of x. Then just try to add elements in matrix like sum(resultMatrix).

Upvotes: 0

Related Questions