- #1
honda221
- 1
- 0
The function should accept the input arrays x and y and to process the data using
linear, semilogy, and log‐log least squares fits to determine which is the best. For this problem, the "best" is given by the smallest value. I wrote the individual scripts for each for the different equations, but I wasn't sure how to compare them to each other in Matlab. Any help would be appreciated!
[a,b,type] = linear_ls2_xxx(x,y)
% This function creates returns the linear parameters of the
% slope (a) and y-intercept (b) given a set of input data (x,y).
% The function attempts to curve fit to linear, semilogy and log-log
% using natural logarithms.
% The returned values indicate those with the smallest sum of squared
% error.
% Calling parameters
%... (you fill in)
% Returned parameters
%... (you fill in)
% type flag indicating which type of equation had the best fit
% type=1 for linear, =2 for semilogy, =3 for log-log
linear, semilogy, and log‐log least squares fits to determine which is the best. For this problem, the "best" is given by the smallest value. I wrote the individual scripts for each for the different equations, but I wasn't sure how to compare them to each other in Matlab. Any help would be appreciated!
[a,b,type] = linear_ls2_xxx(x,y)
% This function creates returns the linear parameters of the
% slope (a) and y-intercept (b) given a set of input data (x,y).
% The function attempts to curve fit to linear, semilogy and log-log
% using natural logarithms.
% The returned values indicate those with the smallest sum of squared
% error.
% Calling parameters
%... (you fill in)
% Returned parameters
%... (you fill in)
% type flag indicating which type of equation had the best fit
% type=1 for linear, =2 for semilogy, =3 for log-log