📄 sinmovie.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. '
' '];
disp(info)
warning off
aviwave=avifile('sinmovie.avi','compression','cinepak');
phi=0;dphi=pi/24;alpha=2*pi/3;
%
figure('units','normalized','Position',[.34 .09 .64 .73],'Name','WAVES ',...
'NumberTitle','off');
k=0;
for phi=(0:2:358)*pi/180;
k=k+1;
theta=0:pi/30:2*pi;
fA=cos(phi)*cos(theta);
fB=cos(phi-alpha)*cos(theta-alpha);
fC=cos(phi+alpha)*cos(theta+alpha);
fR=fA+fB+fC;
plot([0 360],[0 0],'-k','Linewidth',1),grid,hold on
stem(theta*180/pi,fA,'-r')
stem(theta*180/pi,fB,'-g')
stem(theta*180/pi,fC,'-b')
plot(theta*180/pi,fA,'-r','LineWidth',1.5)
plot(theta*180/pi,fB,'-g','LineWidth',1.5)
plot(theta*180/pi,fC,'-b','LineWidth',1.5)
plot(theta*180/pi,fR,'-k','LineWidth',1.5)
stem(theta*180/pi,fR,'-k')
% set(gca,'Xlim',[0 360],'Ylim',[-2.5 2.5],'visible','off');
%set(gca,'Xtick',0:30:360)
% text(140,1.8,'WAVE SPACE DISTRIBUTION','Color','red')
text(60,1.8,'WAVE SPACE DISTRIBUTION','FontSize',16,'FontWeight','bold','color','blue')
text(310,1.9,'Phase A','Fontweight','bold','Color','red')
text(310,1.8,'Phase B','FontWeight','bold','Color','green')
text(310,1.7,'Phase C','Fontweight','bold','Color','blue')
text(310,1.6,'Resultant','FontWeight','bold','Color','black')
text(3,-1.9,'0^o')
text(86,-1.9,'90^o')
text(175,-1.9,'180^o')
text(265,-1.9,'270^o')
text(343,-1.9,'360^o')
set(gca,'Xlim',[0 360],'Ylim',[-2.0 2.0],'visible','on')
set(gca,'Xtick',0:30:360)
hold off
f=getframe(gca);
aviwave=addframe(aviwave,f);
M(k)=getframe;
end
aviwave=close(aviwave);
uicontrol('Units','normalized', ...
'Style','PushButton',...
'BackgroundColor',[.2 .3 .8], ...
'Callback','movie(M,1)', ...
'FontSize',10, ...
'FontWeight','bold', ...
'ForegroundColor',[1 1 1], ...
'Position',[0.24 0.015 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.63 0.015 0.09 .05], ...
'String','Quit', ...
'TooltipString','Quit');
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -