数学建模社区-数学中国

标题: matlab绘制视觉错觉图! [打印本页]

作者: 青年梦想家    时间: 2015-11-19 21:27
标题: matlab绘制视觉错觉图!
本帖最后由 青年梦想家 于 2015-11-19 21:29 编辑








点击看图




%
% 视觉错觉图-
%
% copyright© 2007-2011 $author: baby_wolf $
%                  
% $25-Dec-2011 00:25:14$
%%
clear all
close all
hfig=figure('menu','none','pos',[200 200 800 300],'color','k') ;
hold on
axis([0 1 -2 2]);
axis off
%%  标注
text(0.01,1.1,'@蜀山掌门V','color',[0.5 0.06 0.9],'fontsize',8);
%%  点图
t=0:1/480:479/480;
y=sin(30*2*pi*t).*sin(2*pi*t);
hplot=plot(t,y,'g.','markersize',3);
%% 设置 gif 图片帧数等
numFrames=30;
frames = struct('cdata', [], 'colormap', []);
frames(numFrames) = frames;
%% 循环绘制各帧
k=0;
while k<=30%ishandle(hfig)
    y=y([17:end,1:16]);
   set(hplot,'xdata',t,'ydata',y);         %点图 移动
pause(0.1);
k=k+1;
frames(k)=getframe(gcf);   %获取当前帧
end
%% 写gif文件
animated(1,1,1,numFrames) = 0;
for k=1:numFrames
   if k == 1
      [animated, cmap] = rgb2ind(frames(k).cdata, 256, 'nodither');
   else
      animated(:,:,1,k) = ...
         rgb2ind(frames(k).cdata, cmap, 'nodither');
   end     
end
%%  
filename = 'illusorygif2.gif';
if ~exist(filename,'file');
imwrite(animated, cmap, filename, 'DelayTime', 0.1, ...
   'LoopCount', inf);
end
web(filename)





作者: 1345389794    时间: 2015-11-19 22:31
赞!!!!!!!!!!!!!!!!!!!

作者: 数学中国YY主管    时间: 2015-11-19 23:52
这个图我给满分

作者: 青年梦想家    时间: 2015-11-20 14:36
数学中国YY主管 发表于 2015-11-19 23:52
这个图我给满分



作者: 青年梦想家    时间: 2015-11-20 14:37
1345389794 发表于 2015-11-19 22:31
赞!!!!!!!!!!!!!!!!!!!



作者: 森之张卫东    时间: 2015-11-20 22:50
好厉害的图啊!!!





欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5