📄 spacevec.m
字号:
% SPACE VECTORS <spacevec.m>
clear,clc,close all
disp(date)
info= ...
[' DEFINITION OF SPACE VECTORS '
' Three-phase variables fA, fB, fC (at a given time) '
' are combined in a (2-element) space vector f refer-'
' red to the A_axis. The converse transformation from'
' the space vector f back to the 3-phase components '
' is indicated. Finally, the transformation of f in a'
' new reference frame k is established. '
' The only restriction is that the original 3-phase '
' components have no zero-sequence components , i.e. '
' fA + fB + fC = 0. <spacevec.m> '
' '];
disp(info)
web(which('dqtransform.html'));
%
fA=input('Value for phase A fA = ');
if isempty(fA) fA=1,end
fB=input('Value for phase B fB = ');
if isempty(fB) fB=1,end
fC=-fA-fB;
theta=input('Angle of dq frame referred to A_axis [rad] = ');
if isempty(theta) theta=1,end
G=round(1.3*max(abs([fA,fB,fC])));echo on
fABC=[fA;fB;fC] % three-phase signal
%3-phase unit space vectors
uA=[1;0]; uB=[-1/2;sqrt(3)/2];uC=[-1/2;-sqrt(3)/2];
% ABC==>ab transformation
fA_=fA*uA;fB_=fB*uB;fC_=fC*uC;
fab=2/3*(fA_+fB_+fC_) % space vector f=[fa;fb]
% or fab=2/3*[1 -1/2 -1/2;0 sqrt(3)/2 -sqrt(3)/2]*fABC
% ab==>ABC transformation
fAq=dot(fab,uA); % projection of f on A-axis
fBq=dot(fab,uB); % projection of f on B-axis
fCq=dot(fab,uC); % projection of f on C-axis
fABC1=[fAq;fBq;fCq]
% or fABC=[1 0;-1/2 sqrt(3)/2;-1/2 -sqrt(3)/2]*fab
% ab==>dq transformation
fdq=[cos(theta) sin(theta)
-sin(theta) cos(theta)]*fab % space vector fk=[fd;fq]
% ABC==>dq transformation
fdq1=2/3*[cos(theta) cos(theta-2*pi/3) cos(theta+2*pi/3)
-sin(theta) -sin(theta-2*pi/3) -sin(theta+2*pi/3)]*fABC
% dq==>ABC transformation
fABC2=[cos(theta) -sin(theta)
cos(theta-2*pi/3) -sin(theta-2*pi/3)
cos(theta+2*pi/3) -sin(theta+2*pi/3)]*fdq
% Note that if the d-axis of reference frame k is rotated by a angle theta
% with respect to the A-axis and counted positive for anticlockwise motion,
% the corresponding space vector fdq is derived form the original vector fab
% by rotating it in the opposite direction through the angle -theta.
%
% power transformation
fABC_2=dot(fABC,fABC)
fab_2=3/2*dot(fab,fab)
fdq_2=3/2*dot(fdq,fdq)
echo
%
h0=figure('Position',[405 70 600 560],'Name','Space vectors ',...
'NumberTitle','off');
h1=uicontrol( 'Parent',h0,...
'Style','Popup',...
'Units','normalized', ...
'Callback','popspvec', ...
'Position',[0.82 0.05 0.11 0.05], ...
'String','REPEAT|QUIT');
%
compass(G,0,'k'),title('SPACE VECTORS'),text(1.1*G,-G/15,'A-axis'),hold on
compass(fA_(1),fA_(2),'r'); text(fA_(1),fA_(2),'f_A')
compass(fB_(1),fB_(2),'b'); text(fB_(1),fB_(2),'f_B')
compass(fC_(1),fC_(2),'g'); text(fC_(1),fC_(2),'f_C')
compass(fab(1),fab(2),'m'), text(fab(1),fab(2),'f')
compass(fdq(1),fdq(2),'c'), text(fdq(1),fdq(2),'f_k'),hold off
%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -