# polynomial interpoltaion & least squares

7 views (last 30 days)
Jes on 14 Dec 2021
Commented: Jon on 14 Dec 2021
0 184360.634246042 -211658.511711780 -6853898.76885147
5 219214.256803219 -226785.422707026 -6852351.69754470
10 254061.148627043 -241905.367897281 -6850593.66616310
15 288900.239807604 -257017.882918880 -6848624.72472167
20 323730.460592783 -272122.503660514 -6846444.92962074
25 358550.741525596 -287218.766139992 -6844054.34362999
30 393360.013332653 -302306.206701186 -6841453.03589562
35 428157.207073006 -317384.361885925 -6838641.08193523
40 462941.254118769 -332452.768510410 -6835618.56363502
45 497711.086198094 -347510.963664615 -6832385.56924254
50 532465.635437569 -362558.484708884 -6828942.19336887
55 567203.834312849 -377594.869407128 -6825288.53697975
60 601924.615866041 -392619.655658098 -6821424.70739058
In a general form, the polynomials of degree n can be represented as follows: y = a0t 0 + a1t 1 + a2t 2 + ... + ant n (1)
where y contains the measurements (orbit components x, y or z here) and t is the time vector corresponding to each measurement.
Here the polynomial modeling of the given data y, is the estimation of the unknown coefficients a0, a1,..., an. Assuming that
values: y = [y1, y2, y3, ..., ym]m×1 (2)
are given at time points: t = [t1, t2, t3, ..., tm]m×1. (3)
Then n + 1 coefficients x = [a0, a1, ..., an]1×(n+1) of the polynomials degree n can be simply estimated using least-squares
adjustment: x = (ATA) −1AT y, (4)
i have this data of satelite positions(x,y,z) for 1 minute with 5 sec sampling. 1st colmn is time with 5 sec spacing.
how could i interpolate the positions to 1 second spacing using polynomial. is there a built in fnctn ?

Jon on 14 Dec 2021
I'm not totally clear on what you are trying to do from your description, but here are few things that I think will help you.
You can fit a polynomial to known data using MATLAB's polyfit function. This will give you a vector of polynomial coefficients in descending order.
Once you have the polynomial coefficients you can evaluate them for any value of x using MATLAB's polyval function.
For help on polyfit type doc polyfit on the command line, for help on polyval type doc polyval on the command line
Jon on 14 Dec 2021
Hi, I don't have time at the moment to go through your code in detail, but from a quick look, maybe you want to use the method argument for interp1. This allows you to choose from various methods for performing the interpolation including 'pchip', 'cubic', 'spline' etc.
y = interp1(t,x,tq,'spline')
You can find out more by typing doc interp1 on the command line