Skip to content

Latest commit

 

History

History
48 lines (33 loc) · 2.64 KB

ParabolaCurveFit.md

File metadata and controls

48 lines (33 loc) · 2.64 KB

Parabolic curve fitting using Standard Least Squares

In this case, we read video files of a red ball following a parabolic path and try to fit a curve along it's trajectory using least square method. To test the least square error minimization, we are testing the code for noiseless data (video1) and data with noise (video2)

Computing Standard least square

The equation of parabola is $y = a + bx + cx^2$. Here, we need to find the variables a, b, c such that the error is minimum. The error function can be written as:

To minimize the error, the unknown variables must have zero derivatives. Hence:

Next step is to solve the above three linear equations and get values for a, b, c. The code and result can be found here

Executing code

Navigate to /Problem2 directory

Read data from video
python3 /Problem2/PythonCodes/GetData.py

Enter path to the csv file and input video when prompted
This will generate two files a graph plot png images with coordinate plots and a csv file with ball x,y coordinates

ball_video1.mp4

video1plot

ball_video2.mp4

video2plot

Run linear least square
python3 /Problem2/PythonCodes/LSS.py

This will generate two graph plot png images, with curve fit output of two videos

curvefit1

curvefit2