MATLAB: How to integrate a function whose values are represented by a set of data points at time t instead of continuous function of time t

integration of function with data points

I have a 't' vector(161 elements) from 0 secs to 4secs. By default Matlab has broken it to be :
0
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0000
0.0001
0.0001
0.0001
0.0002
0.0004
0.0005
0.0007
0.0009
0.0018
0.0027
0.0036
0.0045
0.0090
0.0135
0.0179
0.0224
0.0335
0.0446
0.0557
0.0667
0.0796
0.0924
0.1053
0.1181
0.1344
0.1508
0.1671
0.1834
0.1978
0.2122
0.2265
0.2409
0.2532
0.2654
0.2777
0.2900
0.3018
0.3136
0.3254
0.3372
0.3480
0.3588
0.3697
0.3805
0.3934
0.4063
0.4192
0.4321
0.4483
0.4646
0.4809
0.4971
0.5115
0.5259
0.5403
0.5546
0.5673
0.5799
0.5926
0.6052
0.6184
0.6315
0.6446
0.6577
0.6683
0.6790
0.6897
0.7003
0.7136
0.7270
0.7403
0.7536
0.7707
0.7877
0.8048
0.8218
0.8366
0.8514
0.8662
0.8810
0.8958
0.9106
0.9254
0.9402
0.9562
0.9722
0.9883
1.0043
1.0228
1.0413
1.0598
1.0783
1.1024
1.1265
1.1506
1.1747
1.2055
1.2362
1.2670
1.2977
1.3256
1.3535
1.3814
1.4093
1.4471
1.4848
1.5226
1.5603
1.6153
1.6704
1.7254
1.7804
1.8323
1.8842
1.9360
1.9879
2.0489
2.1099
2.1709
2.2319
2.2930
2.3540
2.4150
2.4760
2.5390
2.6020
2.6650
2.7280
2.7782
2.8283
2.8784
2.9286
2.9787
3.0288
3.0790
3.1291
3.1933
3.2574
3.3216
3.3858
3.4500
3.5141
3.5783
3.6425
3.6983
3.7541
3.8099
3.8657
3.8993
3.9328
3.9664
4.0000
Now I have a function whose values I know at all these 161 time instants. But,how can I integrate that function in time domain. I guess I cannot use the existing Matlab commands like 'int' etc. Any suggestions?

Best Answer

My suggestion would be trapz or cumtrapz.
The links to cumtrapz and related functions are at the end of the page.