📄 vecmovie.m
字号:
% MOVIE OF SPACE VECTORS in AC MACHINES
clc,clear,close all
disp(date)
info= ...
[' SPACE VECTORS IN 3-PHASE AC MACHINES '
' This demo animates the motion of pulsating and '
' traveling waves in AC machines. They show the '
' sinusoidal space distributions of magnetic fields '
' in the air gap represented by space vectors. '
' '];
disp(info)
warning off
aviwave=avifile('vecmovie.avi','compression','cinepak');
alpha=2*pi/3;phi=0;
%
figure('units','normalized','Position',[.35 .1 .60 .60],'Name','WAVES ',...
'NumberTitle','off');
set(gcf,'color',[.8 .8 .8])
k=0;
for an=0:2:358
k=k+1;
phi=an*pi/180;
fa=cos(phi); fb=cos(phi-alpha);fc=cos(phi+alpha);
FAx=fa; FAy=0;
FBx=fb*cos(alpha); FBy=fb*sin(alpha);
FCx=fc*cos(alpha); FCy=-fc*sin(alpha);
FRx=FAx+FBx+FCx; FRy=FAy+FBy+FCy;
%
compass(1.4,.04,'w'),hold on
compass(FAx,FAy,'r')
compass(FBx,FBy,'g')
compass(FCx,FCy,'b')
compass(FRx,FRy,'k')
set(findobj(gca,'Type','line'),'LineWidth',3)
text(-0.45,1.9,'SPACE VECTORS','Fontweight','bold','color','k')
text(1.15,-0.062,'A-axis','Fontweight','bold','color','r')
text(-0.9,1.1,'B-axis','Fontweight','bold','color','g')
text(-0.9,-1.1,'C-axis','Fontweight','bold','color','b')
set(gca,'Xlim',[-2.0 2.0],'Ylim',[-2.0 2.0],'visible','off')
axis square
hold off
M(k)=getframe;
%
f=getframe(gca);
aviwave=addframe(aviwave,f);
end
aviwave=close(aviwave);
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','movie(M,.5)', ...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.35 0.1 0.09 .05], ...
'String','Repeat', ...
'TooltipString','Repeat');
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','close,clear,close all', ...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.60 0.1 0.09 .05], ...
'String','Quit', ...
'TooltipString','Quit');
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -