Question

by using matlab

linreg() function file given below

On average, the surface area A of human beings is related to weight W and height H. Measurements of several individuals of he

function [a, al, r2] linreg (x,y) 3 [al, al,r2] linreg (x, y) % Written by: ???, ID: ??? % Last modified: ??? % Performs line

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: If you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

Please note you should have linreg function in your directory saved as linreg.m to run this program

clc
clear all
close all
format long
W=[70,75,77,80,82,84,87,90];
A=[2.1,2.12,2.15,2.2,2.22,2.23,2.26,2.3];
plot(W,A,'ob');
[a0,a1,r2]=linreg(W,log(A));
alpha=exp(a0);
beta=a1;
fprintf('alpha using linreg is %f\n',alpha);
fprintf('beta using linreg is %f\n',beta);
fprintf('r2 using linreg is %f\n',r2);
C=polyfit(W,log(A),1);
a0=C(2);
a1=C(1);
alpha=exp(a0);
beta=a1;
f=@(x) alpha*exp(beta*x);
SSR=sum((A-f(W)).^2);
SST=sum((A-mean(A)).^2);
r2=1-SSR/SST;
fprintf('alpha using polyfit is %f\n',alpha);
fprintf('beta using polyfit is %f\n',beta);
fprintf('r2 using polyfit is %f\n',r2);
x=0:100;
y=f(x);
hold on;
plot(x,y,'--r');

MATLAB R2020a - academic use х HOME PLOTS APPS EDITOR PUBLISH VIEW CE ? Search Documentation Sign In ох A La Find Files Inser

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
by using matlab linreg() function file given below On average, the surface area A of human...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT