CS 5320
Fall Semester 2012

 
Problem 7-1

 
Assigned: 16 October 2012
Due: 25 October 2012
 

Implement the following Matlab function:

function [a,b,c,r,theta,res] = CV_fit_line(pts)
%
%CV_fit_line - fits principal component line to set of points
%On input:
%     pts (nx2 array): x,y values of n points
%On output:
%  a (float): line parameter:  ax + by + c = 0
%  b (float): line parameter:  ax + by + c = 0
%  c (float): line parameter:  ax + by + c = 0
%  r (float): line parameter:  r = xcos(theta) + ysin(theta)
%  theta (float): line parameter:  theta = xcos(theta) + ysin(theta)
%  res (float): residual from line fit
%Call:
%  [a,b,c,r,theta,res] = CV_fit_line([0,0; 1,1; 2,2]);
%Author:
%  Your name
%  UU
%  Fall 2012
%