📄 squirrelwave.m
字号:
% TRAVELING & PULSATING WAVES in AC MACHINES
clc,clear,close all
disp(date)
info= ...
[' Squirrel-cage rotor in a 2-pole field '
' This demo animates the motion of a flux-density wave'
' traveling past a squirrel-cage rotor at slip speed. '
' It also shows the instantaneous bar voltages and '
' and currents with the corresponding rotor mmf wave. '
' A movie can also be run under Windows Media Player '
' by activating "squirrelmovie.avi" file just created.'];
disp(info)
warning off
w=avifile('squirrelmovie.avi','compression','cinepak');
n=98;dphi=2*pi/n;alpha=pi/8;d=8.5;phi=0;
%
figure('units','normalized','Position',[.15 .09 .805 .7],'Name','SQUIRREL-CAGE ROTOR IN A 2-POLE FIELD',...
'NumberTitle','off');
set(gcf,'color',[.9 .9 .9])
for k=1:n
theta=0:pi/8:2*pi;
q=16/(length(theta)-1)*(0:length(theta)-1);
fA=-1.4*(cos(phi)*sin(theta)-sin(phi)*cos(theta));
fB=-(cos(phi-alpha)*sin(theta)-sin(phi-alpha)*cos(theta));
fD=-2.2*(cos(phi-alpha-pi/2)*sin(theta)-sin(phi-alpha-pi/2)*cos(theta));
thetf=0:pi/30:2*pi;
q1=16/(length(thetf)-1)*(0:length(thetf)-1);
fC=-1.8*(cos(phi)*sin(thetf)-sin(phi)*cos(thetf));
fE=-2.2*(cos(phi-alpha-pi/2)*sin(thetf)-sin(phi-alpha-pi/2)*cos(thetf));
%
fill([0 16 16 0 0],[-2.8 -2.8 2.8 2.8 -2.8],[1 1 1],'linewidth',2),hold on
set(gca,'Xlim',[0 16],'Ylim',[-2.8 2.8],'visible','off')
for c=0:16
plot(c,-0.19,'ro','linewidth',2,'MarkerSize',15,'MarkerEdgeColor','k','MarkerFacecolor','r')
end
plot([0 16],[0 0],'-k','Linewidth',2)
plot(q1,fC,'-g','LineWidth',1.5)
plot([0 .5],[fE(59) fE(1)],'-m',q1+.5,fE,'-m','LineWidth',2)
stairs(q-0.05,fD,'-m')
stem(q+.05,fA,'b')
stem(q,fB,'r')
plot(13.7,-2.6,'ro','linewidth',2,'MarkerSize',15,'MarkerEdgeColor','k','MarkerFacecolor','r')
plot(13.7,-2.6,'k.','MarkerSize',10)
plot(10.9,-2.6,'ro','linewidth',2,'MarkerSize',15,'MarkerEdgeColor','k','MarkerFacecolor','r')
plot(10.9,-2.6,'kx','MarkerSize',10)
text(1,-2.4,'Flux density wave','fontweight','b','color','g')
text(1,-2.6,'Rotor mmf wave','fontweight','b','color','m')
text(5,-2.4,'Instantaneous bar voltages','fontweight','b','color','b')
text(11,-2.4,'Instantaneous bar currents','fontweight','b','color','r')
text(11.3,-2.6,'<==positive','color','r')
text(14.1,-2.6,'<==negative','color','r')
text(8,2.63,'SQUIRREL-CAGE ROTOR','FontSize',16,'HOR','center','FontWeight','bold','color','blue')
hold off
f=getframe(gca);
w=addframe(w,f);
phi=phi+dphi;
M(k)=getframe;
end
w=close(w);
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 + -