diff --git a/Part G/part_g.asv b/Part G/part_g.asv index bedf93b..53c0698 100644 --- a/Part G/part_g.asv +++ b/Part G/part_g.asv @@ -9,12 +9,9 @@ for i = 1:length(P) end clf setDefaults -plot(wmax,P,'o') -%P_out = interp1(wmax,P,linspace(.1,.3),'pchip'); -hold on -%plot(linspace(.1,.3),P_out) -x = wmax; -y = P; -Z = x.^3; -a = Z/ -hold off \ No newline at end of file +x = wmax'; +y = P'; +Z = [x.^0, x.^3]; +a = Z\y; +x_fcn = linspace(min(x),max(x)); +plot(x,y,'o',x_fcn,a(1)+a(3)*x_fcn.^2) \ No newline at end of file diff --git a/Part G/part_g.m b/Part G/part_g.m index 1ea9640..016c702 100644 --- a/Part G/part_g.m +++ b/Part G/part_g.m @@ -9,9 +9,9 @@ for i = 1:length(P) end clf setDefaults -x = wmax; +x = wmax'; y = P'; -Z = [x.^3]'; -a = Z\y; -x_fcn = linspace(min(x),max(x)); -plot(x,y,'o',x_fcn,a.*x_fcn) \ No newline at end of file +Z=x.^3; +a=Z\y; +x_fcn=linspace(min(x),max(x)); +plot(x,y,'o',x_fcn,a*x_fcn.^3) \ No newline at end of file