MATLAB: Find the best line

numerical methods

Given the equation:
[(k, a + exp(b k) sin (c k) + d/k )];
k = 1 : 10.
where
a=7
b=1
c=14
d=27.
How do i find the best line and also write the points (Xk, Yk) to be fit? Any little information will be very much apprecited.

Best Answer

I doubt you'd want to fit a line through this. Please give justification for why you think you need to. Nonetheless I've attached a polyfit demo.
a=7
b=1
c=14
d=27
k = 1 : 10
y = a + exp(b * k) .* sin (c .* k) + d./k;
plot(k, y, 'b*-');
grid on;