📄 sinvecmovie.m
字号:
% TRAVELING & PULSATING WAVES in AC MACHINES
clc,clear,close all
disp(date)
info= ...
[' WAVES AND SPACE VECTORS IN AC MACHINES '
' This demo animates the motion of traveling waves '
' in AC machines. They represent the distribution of '
' magnetic fields in the air gap. '
' A movie can also be run under Media Player by acti-'
' vating the "sinvecmovie.avi" file just created. '
' '];
disp(info)
warning off
w=avifile('sinvecmovie1.avi','compression','cinepak');
n=96;dphi=2*pi/n;alpha=2*pi/3;d=8.5;phi=dphi;
%
figure('units','normalized','Position',[.15 .09 .805 .7],'Name','WAVES & SPACE VECTORS',...
'NumberTitle','off');
set(gcf,'color',[1 1 1])
for k=1:n
theta=0:pi/30:2*pi;
q=6/(length(theta)-1)*(0:length(theta)-1);
fA=cos(phi)*cos(theta);
fB=cos(phi-alpha)*cos(theta-alpha);
fC=cos(phi+alpha)*cos(theta+alpha);
fR=fA+fB+fC;
fa=cos(phi); fb=cos(phi-alpha);fc=cos(phi+alpha);
FAx=fa+d; FAy=0;
FBx=(fb*cos(alpha))+d; FBy=fb*sin(alpha);
FCx=(fc*cos(alpha))+d; FCy=-fc*sin(alpha);
FRx=FAx+FBx+FCx-2*d; FRy=FAy+FBy+FCy;
%
fill([0 6 6 0 0],[-2 -2 2 2 -2],[.8 .8 .8]),hold on
plot([0 6],[0 0],'-k','Linewidth',1)
plot(q,fA,'-r','LineWidth',1.5)
plot(q,fB,'-g','LineWidth',1.5)
plot(q,fC,'-b','LineWidth',1.5)
plot(q,fR,'-k','LineWidth',1.5)
fill(2*cos([0:pi/20:2*pi])+d,2*sin([0:pi/20:2*pi]),[.8 .8 .8])
plot([d 1.2+d],[0 0],'--k','LineWidth',1)
set(gca,'Xlim',[-0.5 11.5],'Ylim',[-2 2],'visible','off')
axis equal
plot([d -0.6+d],[0 0.6*sqrt(3)],'--k','LineWidth',1)
plot([d -0.6+d],[0 -0.6*sqrt(3)],'--k','LineWidth',1)
plot(d,0,'xk',[d FAx],[0 FAy],'-r',FAx,FAy,'xr','Linewidth',1.5)
plot(d,0,'xk',[d FBx],[0 FBy],'-g',FBx,FBy,'xg','LineWidth',1.5)
plot(d,0,'xk',[d FCx],[0 FCy],'-b',FCx,FCy,'xb','LineWidth',1.5)
plot(d,0,'xk',[d FRx],[0 FRy],'-k',FRx,FRy,'ok','LineWidth',1.5)
text(9.76,-0.06,'A-axis','color','k')
text(7.5,1.4,'B-axis','color','k')
text(7.5,-1.4,'C-axis','color','k')
text(1,3,'WAVE SPACE DISTRIBUTION','FontSize',14,'FontWeight','bold','color','blue')
text(7.2,3,'SPACE VECTORS','FontSize',14,'FontWeight','bold','color','blue')
text(5,-2.80,'Phase A','FontWeight','bold','Color','red')
text(5,-3.05,'Phase B','FontWeight','bold','Color','green')
text(5,-3.30,'Phase C','FontWeight','bold','Color','blue')
text(5,-3.55,'Resultant','FontWeight','bold','Color','black')
hold off
f=getframe(gca);
w=addframe(w,f);
phi=phi+dphi;
M(k)=getframe;
end
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','movie(M,1)', ...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.31 0.15 0.09 .06], ...
'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.67 0.15 0.09 .06], ...
'String','Quit', ...
'TooltipString','Quit');
w=close(w);
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -