# Help Numerical integration in matlab

1. Jan 6, 2012

### Pereza0

Help!! Numerical integration in matlab

So (assuming the period in a damped harmonic oscillator is constant, because it is right?)

I have been asked to find T= 2* (integral from x1 to x2 of(1/v_num)dx) where x1 and x2 are two consecutive extrema (?? not sure what he means with this, i supossed he mean a max and a min, im spanish and my teacher is german, he doesnt speak spanish and all, and his accent makes me hard to understand what he says in english too. He never told us anything about numerical integration)

where x_num is
Spoiler:
76X1
x_num =

2.5031
3.2700
3.9152
4.3457
4.7871
5.0556
5.1416
5.1963
5.2314
5.0160
4.8071
4.4870
4.0921
3.6850
3.2715
2.7567
2.3136
1.8144
1.3074
0.8447
0.3929
-0.0224
-0.4132
-0.7527
-1.0654
-1.3259
-1.5381
-1.6895
-1.8126
-1.9019
-1.9227
-1.9228
-1.9328
-1.8343
-1.7121
-1.6082
-1.4477
-1.2862
-1.1291
-0.9619
-0.7710
-0.5915
-0.4040
-0.2357
-0.0740
0.0758
0.2112
0.3394
0.4424
0.5282
0.6087
0.6603
0.6900
0.7287
0.7280
0.7292
0.7063
0.6620
0.6168
0.5745
0.5165
0.4525
0.3928
0.3282
0.2538
0.1862
0.1219
0.0601
0.0010
-0.0522
-0.1013
-0.1441
-0.1818
-0.2099
-0.2347
-0.2515

or the mid point version 75X1
x_num_mid =

2.5031
3.2700
3.9152
4.3457
4.7871
5.0556
5.1416
5.1963
5.2314
5.0160
4.8071
4.4870
4.0921
3.6850
3.2715
2.7567
2.3136
1.8144
1.3074
0.8447
0.3929
-0.0224
-0.4132
-0.7527
-1.0654
-1.3259
-1.5381
-1.6895
-1.8126
-1.9019
-1.9227
-1.9228
-1.9328
-1.8343
-1.7121
-1.6082
-1.4477
-1.2862
-1.1291
-0.9619
-0.7710
-0.5915
-0.4040
-0.2357
-0.0740
0.0758
0.2112
0.3394
0.4424
0.5282
0.6087
0.6603
0.6900
0.7287
0.7280
0.7292
0.7063
0.6620
0.6168
0.5745
0.5165
0.4525
0.3928
0.3282
0.2538
0.1862
0.1219
0.0601
0.0010
-0.0522
-0.1013
-0.1441
-0.1818
-0.2099
-0.2347

and v_num is
Spoiler:
75X1
v_num =

9.5859
8.0662
5.3803
5.5174
3.3571
1.0750
0.6840
0.4380
-2.6924
-2.6117
-4.0005
-4.9371
-5.0884
-5.1679
-6.4351
-5.5394
-6.2402
-6.3369
-5.7840
-5.6470
-5.1912
-4.8853
-4.2436
-3.9096
-3.2555
-2.6531
-1.8917
-1.5386
-1.1163
-0.2611
-0.0004
-0.1254
1.2314
1.5276
1.2986
2.0062
2.0181
1.9649
2.0898
2.3855
2.2444
2.3429
2.1041
2.0214
1.8723
1.6927
1.6030
1.2876
1.0721
1.0056
0.6454
0.3718
0.4835
-0.0095
0.0153
-0.2865
-0.5532
-0.5645
-0.5288
-0.7256
-0.8005
-0.7455
-0.8080
-0.9298
-0.8455
-0.8029
-0.7731
-0.7379
-0.6660
-0.6139
-0.5351
-0.4701
-0.3518
-0.3100
-0.2101

Ive done integration in matlab before, but never derived from lab data.

The trouble im having here is that whatever I do, the period I get is about 20-60 secs while looking at x_num and t_num side by side the logical thing would be for it to be 2-5 secs. Been using trapz.

2. Jan 8, 2012

### Pereza0

Re: Help!! Numerical integration in matlab

ok i figured it own alone

Thanks anyway!