In: Math
Data for the mean mass of various animal species and their corresponding metabolic rate is provided below. It is believed that the data follows the power model. i.e. ?????????? = ? (????)? where α and β are the regression coefficients.
|
Animal |
Mass (kg) |
Metabolism (watts) |
|
Cow |
400 |
270 |
|
Human |
70 |
82 |
|
Sheep |
45 |
50 |
|
Hen |
2 |
4.8 |
|
Rat |
0.3 |
1.45 |
|
Dove |
0.16 |
0.97 |
Show by hand with pen and paper the linearisation of this nonlinear model.
answer:
matlab code:
x = [400 70 45 2 .3 .16]; % x data for mass
y = [270 82 50 4.8 1.55 0.95]; % given y data for metabolism
p = polyfit(x,y,2); % fitting the data using polyfit function
Y = polyval(p,x); % metabolism evaluated using
Rsqu = 1-(sum((y-Y).^2)/sum((y-mean(y)).^2)); % Computing the r^2
fprintf('metabolism = %f mass^2+ %f mass + %f\n',p); % Printing the nonlinear equation
fprintf('r^2 = %f\n',Rsqu); % Printing r^2
% Part B
plot(x,y,'rd',0:500,polyval(p,0:500),'b'); % Plotting the data and interpolate function
Mass_Tiger = 200; % Tiger mass
Meta_Tiger = polyval(p,Mass_Tiger); % evaluating tiger metabolism
hold on;
plot(Mass_Tiger,Meta_Tiger,'dk'); % plotting the tiger details in graph
Title = sprintf('metabolism = %f mass^2+ %f mass + %f',p); % using sprintf
title(Title); % Adding title
xlabel('Mass');ylabel('Metabolism'); % adding axes labels
metabolism = -0.001371 mass^2+ 1.220664 mass + 1.078511
r^2 = 0.999686
matlab output:





