📄 imwaves3.m
字号:
% MOVIE OF SPACE VECTORS in AC MACHINES
clc,clear,close all
disp(date)
info= ...
[' SPACE VECTORS IN AC MACHINES '
' [Balanced sinusoidal steady state] '
' This demo animates the motion of stator and rotor '
' space vectors in various reference frames. A stator'
' variable is indicated in blue and a rotor variable '
' in green. The reference frames are identified by x '
' placed at the terminus of the vectors and colored '
' blue for <stator>, green for <rotor>, and black for'
' <synchronous> frames respectively. The animation '
' lasts for one complete cycle of the base stator '
' frequency (ws=1.0 pu)and then repeats itself. '
' A movie can also be run under Media Player by acti-'
' vating the "imwaves.avi" file just created. '
' '];
disp(info)
warning off
n =input('Per-unit rotor speed [default n=0.8] = ');
if isempty(n) n=0.8; end;
%
aviwave=avifile('imwaves.avi');
phis=0;phir=0;phim=0;dphi=pi/24;g=pi/6;
%
figure('units','normalized','Position',[.38 .09 .6 .73],'Name','ROTATING SPACE VECTORS',...
'NumberTitle','off');
set(gcf,'color','w')
for k=1:49
fas=cos(phis);fbs=sin(phis);
far=0.7*cos(phir-g);fbr=0.7*sin(phir-g);
fam=.5*cos(phim);fbm=.5*sin(phim);
faR=far*cos(phim)-fbr*sin(phim);
fbR=far*sin(phim)+fbr*cos(phim);
faS=fas*cos(phim)+fbs*sin(phim);
fbS=-fas*sin(phim)+fbs*cos(phim);
q=0:pi/20:2*pi;
fill(.9*cos(q),0.9*sin(q),[.86 .86 .86]),hold on
fill(.62*cos(q),0.62*sin(q),'w')
fill(.58*cos(q),0.58*sin(q),[.86 .86 .86])
t0={'SPACE VECTORS in SINUSOIDAL STEADY STATE';'VIEWED IN THREE REFERENCE FRAMES'};
t1='SPEED OF VECTORS x:' ;
t2=' Stator frame 1.0';
t5=[' Shaft speed ',num2str(n)];
t3=[' Rotor frame ',num2str(1-n)];
t4=' Synchronous 0';
plot(0,0,'xk',[0 fas],[0 fbs],'-b',fas,fbs,'xb','MarkerSize',10,'LineWidth',1.5)
plot(0,0,'xk',[0 far],[0 fbr],'-g',far,fbr,'xg','MarkerSize',10,'LineWidth',1.5)
plot(0,0,'xk',[0 faR],[0 fbR],'-g',faR,fbR,'xb','MarkerSize',10,'LineWidth',1.5)
plot(0,0,'xk',[0 faS],[0 fbS],'-b',faS,fbS,'xg','MarkerSize',10,'LineWidth',1.5)
plot(0,0,'xk',[0 1],[0 0],'-b',1,0,'xk','MarkerSize',10,'LineWidth',1.5)
plot(0,0,'xk',[0 0.7*cos(g)],[0 -0.7*sin(g)],'-g',0.7*cos(g),-0.7*sin(g),'xk','MarkerSize',10,'LineWidth',1.5)
plot(fam,fbm,'ro','MarkerSize',12,'MarkerEdgeColor','k','MarkerFacecolor','r')
text(.64,-.8,t1,'FontSize',8,'FontWeight','bold','color','k')
text(.6,-0.9,t2,'color','b')
text(.6,-1.0,t3,'color','g')
text(.6,-1.1,t4,'color','k')
text(.6,-1.2,t5,'color','r')
text(0,1.1,t0,'FontSize',14,'FontWeight','bold','ver','middle','hor','center','color','blue')
set(gca,'Xlim',[-1.3 1.3],'Ylim',[-1.3 1.3],'visible','off')
axis square
hold off
%
f=getframe(gca);
aviwave=addframe(aviwave,f);
phis=phis+dphi;
phir=(1-n)*phis;
phim=n*phis;
% M(k)=getframe;
end
aviwave=close(aviwave);
%movie(M,4)
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -