%%  Animation zu Taylorreihe
%  Taylor-Approximation vom Sinus
%  Sie Beispiele zu doc getframe
clear, clc, close all

%%
x = linspace(1e-4,80,100);

n_end = 25;
%colors = ['m','b','g','c'];

h = figure(1);                  % handler for grafics window

count = 1;                      % counter for frame
for n=1:2:n_end
% plotting    
    plot(x,log(x),'-r')         % plot again the correct graph
    hold on
    y = bsp_25_a(x,n);        % approximation
    plot(x,y,'-b');             % plot the graph of approximation
%    plot(x,y,colors( 1+mod(count,length(colors)) ));             % plot the graph of approximanewfiletion
    axis( [ x(1),x(end), -5,5 ] )
    grid on
    title(['Taylorreihenapproximation n = ',num2str(n)])
    hold off
%     pause
% store the plot    
    F(count) = getframe(h);     % store grafics as frame
    count = count+1;
end
disp('... and now the movie')
        % -1   : once forward and backward
movie(h,F,-1,10);               % play movie in Matlab
        %    1 : frames per second  (here, slows down the movie)
% movie(F,10);  % Octave

% movie2avi(F, 'v_7','fps', 1);  % old version: save movie to file with 2 frames per second

filename = [mfilename,'.avi'];
v = VideoWriter(filename);
open(v);
writeVideo(v,F);
close(v);




