inc = 0.001;
t = 0:inc:10;
plot(t,sin(2*pi*t))
grid on
x = sin(2*pi*t);
plot(t,x)
fft(x)
fx = fft(x);
plot(fx)
plot(abs(fx))
ws = pi/inc;
winc = 2*ws/10001;
omega = (-1*ws):winc:(ws-winc);
plot(omega,abs(fx))
omegax = 0:winc:(2*ws-winc);
plot(omegax,abs(fx))
plot(omega,abs(fftshift(fx)))
ts = 0.02;
s = zeros(1,length(t));
for c = 1:length(t), if (abs((t(c)/ts)-round(t(c)/ts)) < 1e-10) s(c) = 1; end,end
plot(t,s)
plot(t(1:100),s(1:100))
plot(t(1:500),s(1:500))
plot(t,s)
xs = x.*s;
plot(t,xs)
fxs = fft(xs);
plot(omega,abs(fftshift(fxs)))
z = ones(1,20);
z
xr = conv(z,xs);
plot(t,xr)
xr = xr(1:10001);
plot(t,xr)
plot(t,xr,t,x)
fxr = fft(xr);
plot(omega,abs(fftshift(fxr)))
plot(omega,abs(fftshift(fxs)))
filter = zeros(1,length(fxs));
sum(omegax<157)
filter(1:250) = ones(1,250);
filter((length(omegax)-250):length(omegax)) = ones(1,251);
fxs = fxs .* filter;
plot(omega,abs(fftshift(fxs)))
xrfft = ifft(fxs);
plot(t,xrfft)
