clear all
close all
f0=250;
f1=500;
fs = 2000;
Nf = 50
M = Nf;
nx = 0:M-1;
dt = 1/fs;
t = dt*nx;
h = fir1(Nf, ((f0+f1)/2) / (2*fs));
x = cos(2*pi*f0*t) + cos(2*pi*f1*t);
tic;
y1 = conv(h, x);
toc;
tic;
xp = [x zeros(1, Nf-1)];
L=ceil(log2(length(xp)));
xp=[xp zeros(1, 2^L-length(xp))];
bp=[h zeros(1, M-1)];
bp=[bp zeros(1,2^L-length(bp))];
Xp=myFFT(xp');
Bp=myFFT(bp');
Y=Xp.*Bp;
y3=real(ifft(Y));
toc;
plot(1:500, y1(1:500), 1:1024, y3(1:1024));
title('Splot');
xlabel('Próbki');
ylabel('Wartość splotu');
legend('Splot z funkcji conv', 'Splot przy pomocy myFFT', 'Location', 'se');
figure(2)
plot(20*log10(abs(fft(y3))));
title('Widmo sygnału wyjściowego')
xlabel('Próbki')
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}