- 积分
- 2831
- 回帖
- 0
- 西莫币
-
- 贡献
-
- 威望
-
- 存款
-
- 阅读权限
- 45
- 最后登录
- 1970-1-1
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
|
本帖最后由 啦啦啦~ 于 2016-8-6 12:22 编辑
你的程序倒数第三行是什么意思啊?
下面的程序是我在你的基础上改点地方
a值是基波百分比,不知道对不对
clc
ss=csvread('ss.csv',1,1);
N=129 ;
n=0:N-1;
t=0:0.1/2/pi:2*pi;
xn=ss(:,1);
k=0:N/2;
WN=exp(1i*2*pi/N);
kn=k'*n;
WNnk=WN.^kn;
Xk=WNnk*xn*2/N;
stem(k,abs(Xk))
abs(Xk);
yy1=abs(Xk(2))*sin(t+pi/2-angle(Xk(2)));
yy2=abs(Xk(3))*sin(2*t+pi/2-angle(Xk(3)));
yy3=abs(Xk(4))*sin(3*t+pi/2-angle(Xk(4)));
yy4=abs(Xk(5))*sin(4*t+pi/2-angle(Xk(5)));
yy5=abs(Xk(6))*sin(5*t+pi/2-angle(Xk(6)));
yy6=abs(Xk(7))*sin(6*t+pi/2-angle(Xk(7)));
yy7=abs(Xk(8))*sin(7*t+pi/2-angle(Xk(8)));
yy8=abs(Xk(9))*sin(8*t+pi/2-angle(Xk(9)));
yy9=abs(Xk(10))*sin(9*t+pi/2-angle(Xk(10)));
yy10=abs(Xk(11))*sin(10*t+pi/2-angle(Xk(11)));
yy11=abs(Xk(12))*sin(11*t+pi/2-angle(Xk(12)));
yy12=abs(Xk(13))*sin(12*t+pi/2-angle(Xk(13)));
yy13=abs(Xk(14))*sin(13*t+pi/2-angle(Xk(14)));
yy14=abs(Xk(15))*sin(14*t+pi/2-angle(Xk(15)));
yy15=abs(Xk(16))*sin(15*t+pi/2-angle(Xk(16)));
yy16=abs(Xk(17))*sin(16*t+pi/2-angle(Xk(17)));
yy17=abs(Xk(18))*sin(17*t+pi/2-angle(Xk(18)));
yy18=abs(Xk(19))*sin(18*t+pi/2-angle(Xk(19)));
yy19=abs(Xk(20))*sin(19*t+pi/2-angle(Xk(20)));
a1=abs(Xk(2))
a2=abs(Xk(3));
a3=abs(Xk(4));
a4=abs(Xk(5));
a5=abs(Xk(6));
a6=abs(Xk(7));
a7=abs(Xk(8));
a8=abs(Xk(9));
a9=abs(Xk(10));
a10=abs(Xk(11));
a11=abs(Xk(12));
a12=abs(Xk(13));
a13=abs(Xk(14));
a14=abs(Xk(15));
a15=abs(Xk(16));
a16=abs(Xk(17));
a17=abs(Xk(18));
a18=abs(Xk(19));
a19=abs(Xk(20));
a=a1/(a1+a2+a3+a4+a5+a6+a7+a8+a9+a10+a11+a12+a13+a14+a15+a16+a17+a18+a19)
figure(1)
plot(n*2*pi/N,xn,t,yy1,t,yy3,t,yy11,t,yy13,t,yy17,t,yy19) |
|