Power regression

%YELLOW1 Example in Section 9.5, Power regression.
%       This M-file calls file YELLOW.M.
%       To obtain hardcopies delete the comment sign, %,
%       preceding the PRINT statement.

yellow          % load data
year = fish(:, 1);
mass = fish(:, 2);
x = year – 1960
loglog(x, mass)
u = log(x);
v = log(mass);
c = polyfit(u, v, 1)
a = exp(c(2))
b = c(1)
y = a*x.^b;
[ mass y ]
plot(year, y, year, mass, ‘o’)
title(‘Example in Section 9.5, Power regression’)
xlabel(‘Year’), ylabel(‘Yellowtail mass, tons’)
text(1971,   3*10^4, ‘Circles represent given points’)
text(1971, 1.5*10^4, ‘Solid line represents interpolation’)
% print
 

 

%YELLOW.M data about production of cultured yellowtail in Japan.
%       Data taken from Jone A, 1987, in Balchen J.G., editor,
%       Automation and Data Processing in Aquaculture, IFAC
%       Symposium, Trondheim, 1986. These data are used in
%       Section 9.5, Power Regression. See file YELLOW1.M.

% The contents of the table are [ year  tons ].
fish = [
1961   1900
1964    9500
1967    21200
1970    43300
1973    80300
1976    101600
1979    154900
1982    146300
1984    154500 ];