Question: ` ` ` function [ coeffVec , r 2 ] = myLinReg _ Username ( xi , yi ) % % % % % %

```
function [coeffVec,r2]= myLinReg_Username(xi,yi)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function file: myLinReg_Username.m
%
%Purpose:
% To obtain the parameters of a L.S. linear best-fit for
% given data
%
%Record of revisions (Date | Programmer | Change):
% Date | Name | Original program
%
%Main Variables:
%INPUTS:
% xi -(1xn) vector of given x values
% yi -(1xn) vector of given y values
%
%OUTPUTS:
% coeffVec-(2x1) vector of coefficients of linear best-fit a0+al*x
% coeffVec(1) is the intercept (a0)
% coeffVec(2) is the slope (a1)
% r2-(1x1) r-square value
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n=length(xi);
assert(length(yi)==n,'xi and yi should be vectors of the same length');
```
` ` ` function [ coeffVec , r 2 ] = myLinReg _

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!