ЦОС(лаба2_1)
.docxN=8;
n=0:1:7;
t=1/8000;
x=2*sin(2*pi*3000*n*t)+sin(2*pi*2000*n*t+5*pi/6)/3;
figure(1)
plot(x),grid on
y=fft(x)
figure(2)
stem(real(y)),grid on
figure(3)
stem(imag(y)),grid on
Xm=abs(y)
figure(4)
stem(Xm),grid on
Xmm=abs(y)/N
figure(5)
stem(Xmm),grid on
N=18;
n=0:1:17;
t=1/81000;
x=sin(2*pi*9000*n*t);
y=fft(x);
xp=fftshift(y);
f=-N/2:1:(N/2-1);
a=abs(xp)/9;
figure(1)
stem(f,a),grid on
x2=sin(2*pi*22222*n*t);
y2=fft(x2);
xp2=fftshift(y2);
a2=abs(xp2)/9;
figure(2)
stem(f,a2),grid on
N=20;
T=1;
fs=100;
t=-1:1/fs:1-1/fs;
nh=(1:N)*2-1;
y=cos(2*pi*nh'*t/T);
Am=2/pi./nh;
Am(2:2:end)=-Am(2:2:end);
s1=y.*repmat(Am',1,length(t));
s2=cumsum(s1);
for k=1:N
subplot(4,5,k)
plot(t,s2(k,:))
end