%这次的改变是在用ifft实现的方式上,经过ifft后得到的是在T/N时间上的采样,由采样波得到原来的等效的低通波形的复包络用插值sinc的方式实现,不过波形还是不一样。郁闷。
% a=[ 1 0 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0 ];
a=[ 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 ];
fs=1000000;
T=0.01;
t=0:1/fs:T-1/fs;
f0=1000;f1=1100;f2=1200;f3=1300;f4=1400;f5=1500;f6=1600;f7=1700;f8=1800;f9=1900;
f=[cos(2*pi*f0*t);-sin(2*pi*f0*t); cos(2*pi*f1*t);-sin(2*pi*f1*t); cos(2*pi*f2*t);-sin(2*pi*f2*t); cos(2*pi*f3*t);-sin(2*pi*f3*t); cos(2*pi*f4*t);-sin(2*pi*f4*t); cos(2*pi*f5*t);-sin(2*pi*f5*t); cos(2*pi*f6*t);-sin(2*pi*f6*t); cos(2*pi*f7*t);-sin(2*pi*f7*t); cos(2*pi*f8*t);-sin(2*pi*f8*t); cos(2*pi*f9*t);-sin(2*pi*f9*t);];
A=repmat(a',1,fs*T);
S1=A.*f;
S2=sum(S1);
figure;plot(t,S2,'.-r');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear
a=[ 1 -1 1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 ];
a1=zeros(2,10);
a1(:)=a;
a2=a1(1,:)+j*a1(2,:);
a3=ifft(a2);
ac=real(a3);
as=imag(a3);
fs=1000000;
T=0.01;
t=0:1/fs:T-1/fs;
for z1=1:10
z=z1-1;
g(z1,:)=(sin(pi/(T/10)*(t-z*(T/10))))./(pi/(T/10)*(t-z*(T/10)));
end
figure;plot(ac,'*-r');
grid on
hold on;plot(as,'+-g');
for z2=1:10
bc(z2,:)=ac(z2).*g(z2,:);
end
for z3=1:10
bs(z3,:)=as(z3).*g(z3,:);
end
bc1=sum(bc);
bs1=sum(bs);
figure;plot(t,bc1,'.-r');hold on;plot(t,bs1,'.-g');
S=bc1.*cos(2*pi*1000*t)-bs1.*sin(2*pi*1000*t);
figure;plot(t,S,'.-r');