powerlaw - %Coeff Matrix ans=CM\a; aa=10^(ans(1));...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function powerlaw(W,A) %Problem 13.11 %W consists of values of weight in kg %A defines surface area of humans related to weight %units are in m^2 % %Measurements on a number of individuals of height 180cm %and different weights give values of A passed into function. % %This program proves Power Law=aW^b fits data well and then predicts %surface area of a given person. %-------------------------------------------------------------------------- %Method for solving nonlinear model fit x=log10(W); a=log10(A); n=length(W); c=ones(n,1); CM=[c x];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: %Coeff Matrix ans=CM\a; aa=10^(ans(1)); fprintf('\na=%5.4f, b=%5.4f\n\n',aa,ans(2)); y=aa.*W.^ans(2); plot(W,A,'s m',W,y); title('Plot of original data with nonlinear model fit:'); ylabel('A(m^2)'); xlabel('W(kg)'); pause %--------------------------------------------------------------------------%method for linearizing data y2=ans(1)+ans(2)*x; plot(x,a,'d',x,y2); title('Plot of linearized data with linear regression fit:'); ylabel('ln(A)'); xlabel('ln(W)'); disp('Judging from the generated graphs, a...
View Full Document

This note was uploaded on 09/27/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

Ask a homework question - tutors are online