Permalink
Browse files

bleh

  • Loading branch information...
1 parent b313eaa commit 008f349b0032b24d6bbf6c901e6d6dac9ce1b0f5 @uberj committed Nov 4, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 labs/lab4/lab4.m
  2. BIN labs/lab4/lab4_turnin.pdf
View
@@ -32,6 +32,8 @@
for i=1:K
xcheb(i)=(a+b)/2 + (b-a)/2 * cos( (i-.5)*pi/K );
end
+plot(xcheb, y, 'o');
+title('N+1 = 11 points spaced by using the chebychev method');
ycheb = f(xcheb);
PNcheb = polyfit(xcheb,ycheb,N);
vcheb = polyval(PNcheb,t);
@@ -41,5 +43,28 @@
plot(x,y,'o',t,f(t),'-',t,vcheb,'--')
title(sprintf('f(t) and Chebychev Interpolation {10}(t), err=%g',cheberr))
+%%
+% The polynomial interpolation provided by matlabs polyfit finds the
+% coefficeints of a p(x) that fit a vector of X points. The
+% interpolation that happens in Problem 2 uses N equally spaced points
+% (shown in Figure 1) and yeilds a polynomial that interpolates the
+% points but also has a lot of error at the ends of the interval (in
+% this case near -5 and 5). The Chebychev polynomial in problem 3 uses
+% X values generated using the equation '(a+b)/2 + (b-a)/2 * cos(
+% (i-.5)*pi/K )'. You can see in Figure 3 that the x values used in
+% the Chebychev polynomial are bunched up near the ends of the
+% interval (-5 to 5). The high error at the ends of the polynomail in
+% Problem 2 is an example of Runge's phenomenom. The chebyshev points
+% help mitigate the error poblem by using a least squares method to
+% ensure a minimun maximum error.
+
%% Problem 4
%%
+% As the number of nodes increases, the error in an interpolating
+% polynomial with equally spaced X values becomes exteremely bad at
+% the end of it's interval. In contrast, the polynomial using
+% chebyshev points get's more and more accurate.
+
+%%
+% To see these poloynomials I changed N (at the top of the file) to 20
+% and then 50.
Binary file not shown.

0 comments on commit 008f349

Please sign in to comment.