% Randy Dimmett
%
% No=To/T
% This is for a triangular signal

close all; clear all;

No=32; % Power of 2

T=1/4;
To=No*T;
Fo=1/To;
Fs=Fo*No;

t=0:T:To-T;
freq=0:Fo:Fs-Fo;

f=[0.5 0.5 0.5 0.5 1 1 1 1 1 zeros(1,23)];

F=fft(f);

figure;
stem(freq,abs(F));
xlabel('Frequency (Hz)');
title('Magnitude of DFT');
figure;
stem(freq,angle(F));
xlabel('Frequency (Hz)');
title('Angle of DFT');

H=[ones(1,5) zeros(1,23) ones(1,4)];

Y=H.*F;
y=ifft(Y);

figure;
stem(t,abs(y));
xlabel('Time (seconds)');
title('Ouput Magnitude');

figure;
stem(t,angle(y));
xlabel('Time (seconds)');
title('Ouput Angle');
