# dimensional data string

1 view (last 30 days)
marciuc on 31 Mar 2011
I have an exercise in mathlab .....
plot(xx18,yy18)
a=mean(xx18)
b=mean(yy18)
c=mean(xx18.^2)
d=mean(yy18.^2)
e=mean(xx18.*yy18)
r=(e-a*b)/sqrt((c-a^2)*(d-b^2))
p=polyfit(xx18,yy18,2)
yt=polyval(p,xx18)
subplot(2,3,1)
plot(xx18,yy18,'r', xx18, yt)
title('Y(X) si Yteoretic(X)')
eroare= yy18-yt
subplot(2,3,2)
plot( eroare,xx18)
title('graficul erorii in raport cu X')
subplot(2,3,3)
plot(eroare,yt)
title('graficul erorii in raport cu Yteoretic')
subplot
plot(xx18,yy18)
a=mean(xx18)
b=mean(yy18)
c=mean(xx18.^2)
d=mean(yy18.^2)
e=mean(xx18.*yy18)
r=(e-a*b)/sqrt((c-a^2)*(d-b^2))
p=polyfit(xx18,yy18,2)
yt=polyval(p,xx18)
subplot(2,3,1)
plot(xx18,yy18,'r', xx18, yt)
title('Y(X) si Yteoretic(X)')
eroare= yy18-yt
subplot(2,3,2) plot( eroare,xx18) title('graficul erorii in raport cu X')
subplot(2,3,3)
plot(eroare,yt)
title('graficul erorii in raport cu Yteoretic')
subplot(2,3,4)
for i=2:length(eroare) hold on plot(eroare(i-1), eroare(i), '*') end
title('graficul punctelor succesive')
subplot(2,3,5)
hist(eroare,10)
title('histograma erorilor')
subplot(2,3,6)
normplot(eroare)
title('graficul probabilitatilor normale')
v=1:length(eroare)
m=polyfit(v,eroare,1)
How do I calculate the slope, where slope is 0 and the location is constant?
and i don't understand those graphs that are generated... 6 graphics ...and what involving them?
Jan on 31 Mar 2011
I assume the titles over the diagrams contain some helpful hints... Sometimes asking even not normal persons yields to useful answers. It is always worth to try it.

Matt Tearle on 31 Mar 2011
polyfit is finding the least-squares best fit to the data for a quadratic polynomial. polyval then evaluates this polynomial at the x data values. Hence yt is a vector of the y values for the fitted (theoretical) model. eroare is therefore the vector of residuals -- ie the difference between the y values predicted by the fitted model and the actual data.
The graphs are showing the data and the fitted model, then various investigations of the residuals, specifically independence and normality.