Help Numerical integration in matlab

In summary, the conversation is about finding the period of a damped harmonic oscillator using numerical integration in MATLAB. The speaker is having trouble with their calculations and is unsure about the meaning of certain terms. They have experience with integration in MATLAB, but not with deriving data from lab experiments. Ultimately, they were able to figure out the issue on their own.
  • #1
Pereza0
3
0
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, I am spanish and my teacher is german, he doesn't 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 I am 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.
 
Physics news on Phys.org
  • #2


ok i figured it own alone

Thanks anyway!
 

Related to Help Numerical integration in matlab

What is numerical integration in Matlab?

Numerical integration in Matlab is a method used to approximate the value of an integral (area under a curve) using numerical techniques. It is a useful tool in solving mathematical problems that cannot be solved analytically.

How do I perform numerical integration in Matlab?

To perform numerical integration in Matlab, you can use the built-in function "integral". This function takes in the function to be integrated, the limits of integration, and other optional parameters to adjust the accuracy of the approximation.

What are the different types of numerical integration methods in Matlab?

There are several types of numerical integration methods in Matlab, such as the Trapezoidal rule, Simpson's rule, and Gaussian quadrature. Each method has its own advantages and is suitable for different types of integrals and functions.

What is the importance of numerical integration in Matlab?

Numerical integration in Matlab is important because it allows for the approximate calculation of integrals that cannot be solved analytically. This is useful in a wide range of fields, including engineering, physics, and finance.

How can I improve the accuracy of my numerical integration in Matlab?

To improve the accuracy of numerical integration in Matlab, you can adjust the parameters of the "integral" function, such as the number of points used in the approximation or the tolerance level. You can also try using different integration methods to see which one gives the most accurate result for your specific problem.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
9K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
23K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
12K
Back
Top