% GeepHBvH.m
load geep;
DATA=DATA';
HP=shannon(DATA,1);
HB=brillouin(DATA);
HP=HP';
[r,c]=size(DATA);
% To fit the Y intercept in Matlab, need to have a column vector of 1's:
X=[ones(r,1) HP(:,1)]
Y=HB;
B=X\Y;
    fprintf('\nThe Y intercept = %5.3f and slope = %5.3f\n',B(1),B(2));
    Yest=X*B;
    C=corrcoef(HP,HB).^2;
    s=sprintf('HB = %5.3f + %5.3f H'', R^2 = %4.1f%%',B,C(1,2)*100);
    Resid=Y-Yest;
    % sort by the independent variable so the lines are smooth
    [Xs,k]=sort(X(:,2));
    % sort the estimated values using the index vector k:
    Ys=Yest(k);
    plot(HP,HB,'sg',Xs,Ys,'-r','LineWidth',2);
    xlabel('Shannon''s H''','FontSize',16),
    ylabel('Brillouin''s H','FontSize',16)
    text(1.45,  2.4,s,'FontSize',16)
    title('GEEP H vs. H''','FontSize',20)
    figure(gcf)