function[]=ejer ()
X=importdata('Regresion.csv');
b=((length(X.data)*sum(X.data(:,1).*X.data(:,2)))-(sum(X.data(:,1))*sum(X.data(:,2))))/(length(X.data)*sum(X.data(:,1).^2)-(sum(X.data(:,1)))^2);
a=(sum(X.data(:,2))-b*sum(X.data(:,1)))/length(X.data);
y=a*(X.data(:,1))+b;
figure,plot(X.data(:,1),X.data(:,2),'o r')
hold on
plot(X.data(:,1),y,'g')
end
X=importdata('Regresion.csv');
b=((length(X.data)*sum(X.data(:,1).*X.data(:,2)))-(sum(X.data(:,1))*sum(X.data(:,2))))/(length(X.data)*sum(X.data(:,1).^2)-(sum(X.data(:,1)))^2);
a=(sum(X.data(:,2))-b*sum(X.data(:,1)))/length(X.data);
y=a*(X.data(:,1))+b;
figure,plot(X.data(:,1),X.data(:,2),'o r')
hold on
plot(X.data(:,1),y,'g')
end