clc;clear;
syms size Bedroom Floors Age Price q rate
c
x0=[1;1;1;1];
size=[2104;1416;1534;852]/2104;
Bedroom=[5;3;3;2]/5;
Floors=[1;2;2;1]/2;
Age=[45;40;30;36]/45;
Price=[460;232;315;178];
q=[1;1;1;1;1];
x=[x0 size Bedroom Floors Age]';
h=(q'*x)';
for i=1:100000
q=q-(rate/4)*((h-Price)'*x')'
h=(q'*x)';
df=((h-Price)'*x')';
if abs(min(df))<0.1
break;
end
end
q'*x