Skip to content
Permalink
d2e428c722
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
15 lines (13 sloc) 505 Bytes
%----Calculation of 1c.----------------------------
%Z matrix calculation altered to best fit polynomial
x = [0.5 1 2 3 4 5 6 7 9]';
y = [6 4.4 3.2 2.7 2.2 1.9 1.7 1.4 1.1]';
Z = [exp(-1.5.*x) exp(-0.3.*x) exp(-0.05.*x)]; %Compute Z matrix (from book)
[a, fx, r_2] = linear_squares(Z,y) %apply to linear_squares.m
x_fn = linspace(min(x),max(x));
% Plot to show fit
plot(x,y,'o',x_fn, a(1)*exp(-1.5.*x_fn)+a(2)*exp(-0.3.*x_fn)+a(3)*exp(-0.5.*x_fn));
title('Best fit case C');
xlabel('x');
ylabel('y');
%