function povray_animation
r = -25;
no_of_points = 50;
x = r*cosd(linspace(0,360,no_of_points))
for i=1:no_of_points
pov_file = fopen(fullfile(cd,sprintf('out%.0f.pov',i)),'w');
fprintf(pov_file,'#include "colors.inc"\n');
fprintf(pov_file,'background {color White}\n');
fprintf(pov_file,'camera {location <%f,25,25>\n',x(i));
fprintf(pov_file,'\tsky <0,0,1>\n');
fprintf(pov_file,'\tlook_at <10,0,0>}\n');
fprintf(pov_file,'light_source {<%f,25,25> color White}\n',x(i));
fprintf(pov_file, ...
'cylinder {<0,0,0>,<10,0,0>,1 texture {pigment {color Red}}}\n');
fprintf(pov_file, ...
'cylinder {<0,0,0>,<0,10,0>,1 texture {pigment {color Green}}}\n');
fprintf(pov_file, ...
'cylinder {<0,0,0>,<0,0,10>,1 texture {pigment {color Blue}}}\n');
fprintf(pov_file, ...
'sphere {<10,10,10>,3 texture {pigment {color OrangeRed}}}\n');
fclose(pov_file);
cd_string = 'cd c:\program files\pov-ray\v3.7\bin';
command_string = sprintf('%s\npvengine +W340 +H280 %s +A /exit', ...
cd_string, ...
fullfile(cd,sprintf('out%.0f.pov',i)));
batch_file = fopen('pov.bat','w');
fprintf(batch_file,'%s\n',command_string);
fclose(batch_file);
system('pov.bat');
end