The solution would be like:
% Assuming your data (2-by-28)
data = rand(2,28);
% Set x and y
x = data(1,:);
y = data(2,:);
% Fit to y = ax + b
p = polyfit(x,y,1);
yfit = polyval(p,x);
% View the result
figure
scatter(x,y)
hold on
plot(x,yfit)
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!