negativesequsource.m
来自「电力系统中负序信号的Matlab仿真,包含simlink例程一个,负序仿真程序三」· M 代码 · 共 120 行
M
120 行
%负序分量求解
figure(1);
for m=1:1281 %负序的时域算法
realpart(m)=ua(m,1)+(-0.5-3^0.5*0.5j)*ub(m,1)+(-0.5+3^0.5*0.5j)*uc(m,1);
end
mag=abs(realpart)/3; %
ang=phase(realpart);
subplot(211);
plot(mag);
for m=1:1281
realpart2(m)=ua2(m,1)+(-0.5-3^0.5*0.5j)*ub2(m,1)+(-0.5+3^0.5*0.5j)*uc2(m,1);
end
mag2=abs(realpart2)/3;
ang2=phase(realpart2);
subplot(212);
plot(mag2);
%-------------------------------------fft不对称--------------------------------
%fft ua
figure(2);
j=1;k=1;
for m=1:1280
ipcb(k)=ua(m,1);
if k==128
Y=fft(ipcb,128);
sa(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
%fft ub
j=1;k=1;
for m=1:1280
ipcb(k)=ub(m,1);
if k==128
Y=fft(ipcb,128);
sb(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
%fft uc
j=1;k=1;
for m=1:1280
ipcb(k)=uc(m,1);
if k==128
Y=fft(ipcb,128);
sc(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
%---------------
for j=1:9
realpart=( real(sa(j,2)) - 0.5*( real(sb(j,2))+real(sc(j,2)) ) + 0.8660254037*( imag(sb(j,2)) - imag(sc(j,2)) ) )/3;
imagpart=( imag(sa(j,2)) - 0.5*( imag(sb(j,2))+imag(sc(j,2)) ) + 0.8660254037*( real(sb(j,2)) - real(sc(j,2)) ) )/3;
negsequ(j)=sqrt(realpart^2+imagpart^2);
end
subplot(211);
stem(negsequ(1,1:9));
%---------------------------------------fft 对称-------------------------
%fft ua2
figure(2);
j=1;k=1;
for m=1:1280
ipcb(k)=ua2(m,1);
if k==128
Y=fft(ipcb,128);
sa(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
ts=1:9;
%fft ub2
j=1;k=1;
for m=1:1280
ipcb(k)=ub2(m,1);
if k==128
Y=fft(ipcb,128);
sb(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
ts=1:9;
%fft uc2
j=1;k=1;
for m=1:1280
ipcb(k)=uc2(m,1);
if k==128
Y=fft(ipcb,128);
sc(j,:)=Y;
j=j+1;
k=1;
end
k=k+1;
end
ts=1:9;
%---------------
for j=1:9
realpart=( real(sa(j,2)) - 0.5*( real(sb(j,2))+real(sc(j,2)) ) + 0.8660254037*( imag(sb(j,2)) - imag(sc(j,2)) ) )/3;
imagpart=( imag(sa(j,2)) - 0.5*( imag(sb(j,2))+imag(sc(j,2)) ) + 0.8660254037*( real(sb(j,2)) - real(sc(j,2)) ) )/3;
negsequ(j)=sqrt(realpart^2+imagpart^2);
end
subplot(212);
stem(negsequ(1,1:9));
% realPart =((float)(MapingIpcb[AD_MAPPING_VA][hn])-\
% 0.5*((float)(MapingIpcb[AD_MAPPING_VB][hn])+(float)(MapingIpcb[AD_MAPPING_VC][hn]))+\
% 0.8660254037*((float)(MapingIpcb[AD_MAPPING_VB][hn+1])-(float)(MapingIpcb[AD_MAPPING_VC][hn+1])))/3;
% imagePart=((float)(MapingIpcb[AD_MAPPING_VA][hn+1])-\
% 0.5*((float)(MapingIpcb[AD_MAPPING_VB][hn+1])+(float)(MapingIpcb[AD_MAPPING_VC][hn+1]))-
% 0.8660254037*((float)(MapingIpcb[AD_MAPPING_VB][hn])-(float)(MapingIpcb[AD_MAPPING_VC][hn])))/3;
%
%file end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?