怎么改截取长度的1/2
clear;
t = 0 : 160/499 : 40;
T = 0.08;
f0 = 10000;
f = [10 50 100];
N = 500;
dw = 0.01;
w = -100 : dw : 100;
num = length(f);
s = zeros(1, N);
for i = 1 : num
s = s + 4 * sin(f(i)*2*pi*(1:N)/f0+pi/2);
end
subplot(411)
plot(s);
axis([1 N 1.1*min(s) 1.1*max(s)]);
grid on
r = zeros(1, N/4);
for i = 1 : num
r = r + 4 * sin(f(i)*2*pi*(1:N/4)/f0+pi/2);
end
subplot(412);
plot(r);
axis([1 N 1.1*min(s) 1.1*max(s)]);
grid on
R=r*exp(-1i*t'*w)*T;
Hm1 = abs(R);
phai1 = angle(R);
Hr1 = real(R);
Hi1 = imag(R);
subplot(413)
plot (w, Hm1);
axis([-100 100 0 100]);
grid on
subplot(414)
plot (w, phai1);
axis([-20 20 -3 3]);
grid on |