From 74ae78a77655ab1e8dd33e9c5dcf2519e489f841 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Wed, 9 Sep 2015 04:28:38 +0000 Subject: [PATCH] simulation of xor gate as amixer git-svn-id: https://svn.code.sf.net/p/freetel/code@2302 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/octave/xormixer.m | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 codec2-dev/octave/xormixer.m diff --git a/codec2-dev/octave/xormixer.m b/codec2-dev/octave/xormixer.m new file mode 100644 index 00000000..bbecaf13 --- /dev/null +++ b/codec2-dev/octave/xormixer.m @@ -0,0 +1,37 @@ +% xormixer.m +% David Rowe Sep 2015 +% +% Testing xor gate as a mixer for constant amplitude +% modulation schemes + +n = 1024; +carrier = modulation = zeros(1,n); + +Tc = 4; % carrier period +for i=1:Tc:n + carrier(i:i+Tc/2-1) = 1; +end + +Tm = 32; % modulation signal period +for i=1:Tm:n + modulation(i:(i+Tm/2-1)) = 1; +end + +carrier = carrier .* hanning(n)'; +modulation = modulation .* hanning(n)'; +mixer = xor(carrier,modulation) .* hanning(n)'; + +figure(1); +clf +subplot(311) +plot(abs(fft(carrier))) +axis([1 n 0 n/2]); + +subplot(312) +plot(abs(fft(modulation))) +axis([1 n 0 n/2]); + +subplot(313) +plot(abs(fft(mixer))) +axis([1 n 0 n/2]); + -- 2.25.1