calculate NF from GNU Radio IQ files
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 9 Mar 2016 09:56:57 +0000 (09:56 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 9 Mar 2016 09:56:57 +0000 (09:56 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@2718 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/nf_from_gr.m [new file with mode: 0644]

diff --git a/codec2-dev/octave/nf_from_gr.m b/codec2-dev/octave/nf_from_gr.m
new file mode 100644 (file)
index 0000000..59cc293
--- /dev/null
@@ -0,0 +1,33 @@
+% nf_from_gr.m
+% David Rowe Mar 2016
+
+% TODO: [ ] synthetic signal to test
+%       [ ] if sine wave power goes up what happens?
+
+p = load_comp("~/Desktop/neg100dBm_2MHz.bin");
+pn = load_comp("~/Desktop/nosignal_2MHz.bin");
+
+Pin = -100;             % rx power input of p in dBm 
+Fs = 2E6;               % sample rate in Hz
+st = 100E3; en = 300E3; % frequencies window to use
+P = fft(p100(1:Fs));
+N = fft(pns(1:Fs));
+
+PdB = 10*log10(abs(P));
+NdB = 10*log10(abs(N));
+
+figure(1)
+clf;
+
+subplot(211)
+plot(st:en, PdB(st:en));
+
+subplot(212)
+plot(st:en, NdB(st:en));
+
+P = 10*log10(P_pwr);
+No = 10*log10(No_pwr);
+G = P - Pin;
+NF  = No - G + 174;
+printf("Pin: %4.1f  Pout: %4.1f  G: %4.1f  NF: %3.1f\n", Pin, P, G, NF);