- #1

Wrichik Basu

Gold Member

- 1,491

- 1,346

Matlab:

```
h = [29.3 25.3 19.7 16.0 10.9];
v = [0.53 0.47 0.37 0.29 0.21];
plot(h,v,'obk')
hold on
p = polyfit(h,v,1);
y = polyval(p,h);
plot(h,y,'-bk')
```

I can extrapolate the best fit line using the following code:

Matlab:

```
x = -1:0.01:11;
>> y = polyval(p,x);
>> plot(x,y,'--r')
```

Evidently, the line doesn't pass through (0,0).

But I have to make it pass through the Origin. In that case, it will no longer be the best fit line, but nevertheless it will serve my purpose.

Any idea on how to do this?