Skip to content
Permalink
d2e428c722
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
13 lines (10 sloc) 383 Bytes
%----Calculation of 1a.----------------------------
x = [1 2 3 4 5]'; %Column vector x
y = [2.2 2.8 3.6 4.5 5.5]'; % Column vector y
Z = [x.^0 x x.^-1]; %Compute Z matrix (from book)
[a, fx, r_2] = linear_squares(Z,y) %apply to linear_squares.m
x_fn = linspace(min(x),max(x));
plot(x,y,'o',x_fn, a(1)+a(2)*x_fn+a(3)*x_fn.^-1);
title('Best fit case A');
xlabel('x');
ylabel('y');