Predicting the house price | Linear Regression Multiple Variables | MATLAB

Datasets:-
area bedrooms age price
2600 3 20 550000
3000 4 15 565000
3200 3 18 610000
3600 3 30 595000
4000 5 8 760000

Code:-

clc
clear all
close all
format longG
x1=[2600 3000 3200 3600 4000];
x2=[3 4 3 3 5];
x3=[20 15 18 30 8];
y=[550000 565000 610000 595000 760000];
n=length(x1);
a=[ones(n,1) x1' x2' x3'];
c=pinv(a)*y';

No comments