Sft_get_coefficients - are periodic m the degree of the trig polynomial output b_1 b{m 1 the Fourier coefficients of the trigonometric polynomial

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function b = sft_get_coefficients (y,m) % usage: b = sft_get_coefficients (y,m) % computes the Fourier coefficients % sft stands for Slow Fourier Transform % % approximate or interpolate n data points % use trigonometric polynomial of degree m, with % 2m+1 < n for approximation % 2m+1 = n or 2m = n for interpolation % input: % y the row vector of function values to be approximated % on the n evenly spaced points % j*2*pi/n where j=0:n-1 % Notice that the point 2*pi (j=n) is not included, % because it is automatically assumed that the data
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % are periodic. % m the degree of the trig polynomial % output: % b_1, . .., b_{m+1} the Fourier coefficients of the % trigonometric polynomial % the trig polynomial may be evaluated using the % function sft_evaluate % method: % since b_k is a polynomial in exp(-2*pi*i*(k-1)/n), use % Horner's rule % n=length(y); b = zeros(m+1,1)+y(n); c=b; const = exp(-2*pi*i/n); c(1) = 1; for k = 1:m c(k+1) = c(k)*const; end; for j=(n-1):-1:1 b=y(j) + b.*c; end; b = b*2/n; b(1)=0.5*b(1); if n == 2*m b(m+1)= 0.5*b(m+1); end;...
View Full Document

This note was uploaded on 09/19/2009 for the course MATH numerical taught by Professor Ford during the Spring '09 term at FAU.

Ask a homework question - tutors are online