help with this matlab script

1 view (last 30 days)
charlotte davis
charlotte davis on 2 Oct 2014
Answered: Nalini Vishnoi on 2 Oct 2014
Write a MATLAB script which will load an n x 2 matrix A of data and determine slope m and y intercept b of a line which minimizes the least square distance the data {A(I,1),A(I,2)} from I=1 to n and the points {A(I,1),mA(I,1)+b} from I=1 to n.
for i=1:10000
rref (A)
I got an error message: Undefined function 'x' for input arguments of type 'double'.

Answers (1)

Nalini Vishnoi
Nalini Vishnoi on 2 Oct 2014
You are getting this error because variables x and y are not defined in your script. I think what you intended was something like the following:
x = A(:,1);
y = A(:,2);


No tags entered yet.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!