clear %% X=(2*randn(50,1)+6) % mean(X)~6 std(X)~2 Y=(3*randn(50,1)+8) % mean(Y)~? std(Y)~? (think about range and shift) % subplot(1,3,1) plot(X,Y,'rO','linewidth',2) hold on % the mode of adding new charts is enabled - on mx=mean(X), my=mean(Y) plot(mx,my, 'rsq','markersize',16,'linewidth',2) grid on %% Centering: XX=X-mean(X); YY=Y-mean(Y); % subplot(1,3,2) plot(XX,YY,'b<','linewidth',2) mxx=mean(XX), myy=mean(YY) plot(mxx,myy, 'b<','markersize',18,'linewidth',2) %% Standardization: XXX=(X-mean(X))/std(X); YYY=(Y-mean(Y))/std(Y); sy=mean(YYY), sx=mean(XXX) % subplot(1,3,3) plot(XXX,YYY,'gsq','linewidth',2) %'gsq' - means 'green' & 'square' plot(sx,sy, 'g>', 'markersize',16,'linewidth',2) C={'Initial Data', 'center Point', 'After Centering','center Point','After Standardization','center Point'} lg=legend(C{:}); lg.FontSize=14; set(gca,'fontsize',12)