📄 infomovies.m
字号:
% ANIMATIONS
clc,clear,close all
inf(1)={' How to produce and play the movies: '};
inf(2)={'Movies of machines, space vectors, magnetic field distributions in motion are produced by accessing'};
inf(3)={'the script files listed under the heading "Animations". Each movie can then be rerun (repeat).'};
inf(4)={'At the same time, a video clip in the form of an .avi file is created and saved. It can be run within MATLAB'};
inf(5)={'by invoking the "uiimport" command. '};
inf(6)={'This .avi file can also be played in WINDOWS using Windows Media Player;' };
inf(7)={'the player options of "repeat" and "captions" should then be enabled.' };
inf(8)={'These video clips are also available on the Web.' };
inf(9)={'(the present clip is named "info.avi")' };
avisqui=avifile('info.avi','compression','cinepak');
h0=figure('units','normalized','numbertitle','off','name','ANIMATIONS','menubar','none','units','normalized',...
'position',[0.2 .2 .66 .7]);
set(gcf,'color',[.8 .8 .8])
h1 = uicontrol('Parent',h0, ...
'Units','normalized', ...
'BackgroundColor',[0.76 0.76 0.76], ...
'FontWeight','bold', ...
'ForegroundColor',[0 0 0.6], ...
'HorizontalAlignment','left', ...
'Position',[0.05 0.8 0.9 0.2], ...
'String',inf, ...
'Style','text');
% squirrel-cage induction machine picture
e=0;z=0;
dir=[0 0 1];
%q=0:pi/20:2*pi;
%z1=ones(size(q));
lv=[cos(60*pi/180),cos(90*pi/180),cos(120*pi/180)];
%
for e=0:100
z=z+1;
p=-1:.4:2;
[X,Y,Z]=cylinder(.5,200);surf(X,Y,Z,'facecolor',[.6 .6 .6],'edgecolor',[.9 .9 .9 ]);hold on
[X,Y,Z]=cylinder(1,200);surf(X,Y,Z,'facecolor',[.6 .6 .6],'edgecolor',[.9 .9 .9]);
[X,Y,Z]=cylinder(.6,24);h1=surf(X,Y,Z,'facecolor',[.6 .8 .8],'edgecolor','y','linewidth',6);
plot3(zeros(size(p)),zeros(size(p)),p,'color',[.5 .4 .4],'linewidth',15);
rotate(h1,dir,e)
axis equal
set(gca,'visible','off','cameraupvector',lv)
hold off
f=getframe(gcf);
avisqui=addframe(avisqui,f);
M(z)=getframe(gca);
end
avisqui=close(avisqui);
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','movie(M,.5)', ...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.19 0.15 0.11 .06], ...
'String','Repeat', ...
'TooltipString','Repeat');
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','animations',...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.72 0.15 0.11 .06], ...
'String','Return', ...
'TooltipString','Return');
rotate3d
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -