clear

tt = linspace(-1.5*pi,1.5*pi,2001);
n  = 2000;

uu  = zeros(size(tt));
duu = zeros(size(tt));
for j = n:(-1):1
  uu  =  uu +         (1/(j^(7/4)))*cos((2*j+1)*tt);
  duu = duu - (2*j+1)*(1/(j^(7/4)))*sin((2*j+1)*tt);
end

figure(1)
subplot(2,1,1)
plot(tt,uu)
axis([min(tt),max(tt),-2,2])
title(sprintf('The function w_n for n = %d',n))
subplot(2,1,2)
plot(tt,duu)
axis([min(tt),max(tt),-10,10])
title(sprintf('The derivative of w_n for n = %d',n))

ww  = zeros(size(tt));
dww = zeros(size(tt));
for j = n:(-1):1
  ww  =  ww +         (1/(j^(9/4)))*cos((2*j+1)*tt);
  dww = dww - (2*j+1)*(1/(j^(9/4)))*sin((2*j+1)*tt);
end

figure(2)
subplot(2,1,1)
plot(tt,ww)
axis([min(tt),max(tt),-2,2])
title(sprintf('The function w_n for n = %d',n))
subplot(2,1,2)
plot(tt,dww)
axis([min(tt),max(tt),-10,10])
title(sprintf('The derivative of w_n for n = %d',n))

