File:Square wave summation animation.gif

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Square_wave_summation_animation.gif (200 × 200 pixels, file size: 116 KB, MIME type: image/gif, looped, 108 frames, 11 s)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: The animation shows the square wave being constructed. The blue curve is the summation of the previous frequencies while the red curve is the frequency that is currently added.

freq = 1/(2*pi); x = 0:0.01:2*pi; figure(1) filename = 'image.gif'; flag_first = 1 map = @(x) -2*x.^3+3*x.^2 % maps [0,1] to [0,1] for n = 1:8

   s = @(x,k) bsxfun(@rdivide,sin(bsxfun(@times,2*pi*(2*k-1)*freq,x)),(2*k-1));
   f = @(x,t) 4/pi * (sum(s(x,[1:n-1]'),1) + t*sin(2*pi*(2*n-1)*x*freq)/(2*n-1));
   for t = map(linspace(0,1,18-n))
       clf
       hold on
       plot(x,f(x,t))
       plot(x,t*4/pi*sin(2*pi*(2*n-1)*x*freq)/(2*n-1),'r-')
       axis([0,2*pi,-1.5,1.5]);
       text(-0.2,1.5,['f = ',num2str(2*n-1)])
       set(gcf,'color',[1 1 1]);
       axis off
       hold off
       drawnow
       frame = getframe(1);
       im = frame2im(frame);
       [imind,cm] = rgb2ind(im,256);
       if flag_first == 1;
           imwrite(imind,cm,filename,'gif', 'Loopcount',inf, 'DelayTime',0.1);
           flag_first = 0;
       else
           imwrite(imind,cm,filename,'gif','WriteMode','append','DelayTime',0.1);
       end
   end
end
Date
Source Own work
Author Feudiable

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license.
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current21:05, 25 May 2014Thumbnail for version as of 21:05, 25 May 2014200 × 200 (116 KB)Feudiable (talk | contribs)smaller resolution
00:04, 25 May 2014Thumbnail for version as of 00:04, 25 May 2014560 × 420 (260 KB)Feudiable (talk | contribs)User created page with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file: