x = 1:12; y = [6.224 6.665 6.241 5.302 5.073 5.127 4.994 5.012 5.108 5.377 5.510 6.372]*10^6; x = (x-0.5)/12; A = [ones(12,1) cos(2*pi*x') sin(2*pi*x') cos(4*pi*x')] A = 1.00000000000000 0.96592582628907 0.25881904510252 0.86602540378444 1.00000000000000 0.70710678118655 0.70710678118655 0.00000000000000 1.00000000000000 0.25881904510252 0.96592582628907 -0.86602540378444 1.00000000000000 -0.25881904510252 0.96592582628907 -0.86602540378444 1.00000000000000 -0.70710678118655 0.70710678118655 -0.00000000000000 1.00000000000000 -0.96592582628907 0.25881904510252 0.86602540378444 1.00000000000000 -0.96592582628907 -0.25881904510252 0.86602540378444 1.00000000000000 -0.70710678118655 -0.70710678118655 0.00000000000000 1.00000000000000 -0.25881904510252 -0.96592582628907 -0.86602540378444 1.00000000000000 0.25881904510252 -0.96592582628907 -0.86602540378444 1.00000000000000 0.70710678118655 -0.70710678118655 -0.00000000000000 1.00000000000000 0.96592582628907 -0.25881904510252 0.86602540378444 c = A\y' c = 1.0e+06 * 5.58375000000000 0.69686216653820 0.31298484741002 0.09944858386791 norm((A*c)'-y) ans = 7.547408574050438e+05 plot(x,y,x,A*c,'o') diary off