aboutsummaryrefslogtreecommitdiff
path: root/octave/make_hilb.m
diff options
context:
space:
mode:
authordrowe67 <[email protected]>2023-07-07 14:42:02 +0930
committerDavid Rowe <[email protected]>2023-07-07 14:42:02 +0930
commitfbbd89ddf8cd49c5865ec05ebcfc2c5cedcbb5e5 (patch)
treeccb35a163ceedc23b30555161e46da53768ff846 /octave/make_hilb.m
parenta291cfaf4ca3bb359852336f796aa5cc64568826 (diff)
yet more Octave files rm-ed
Diffstat (limited to 'octave/make_hilb.m')
-rw-r--r--octave/make_hilb.m60
1 files changed, 0 insertions, 60 deletions
diff --git a/octave/make_hilb.m b/octave/make_hilb.m
deleted file mode 100644
index 6c6323c..0000000
--- a/octave/make_hilb.m
+++ /dev/null
@@ -1,60 +0,0 @@
-% make_hilb.m
-% David Rowe May 2015
-%
-% creates Hilber Transformer FIR coeffs
-
-graphics_toolkit ("gnuplot");
-
-% from https://www.dsprelated.com/freebooks/sasp/Hilbert_Transform_Design_Example.html
-
-M = 257; % window length = FIR filter length (Window Method)
-fs = 8000; % sampling rate assumed (Hz)
-f1 = 100; % lower pass-band limit = transition bandwidth (Hz)
-beta = 8; % beta for Kaiser window for decent side-lobe rejection
-fn = fs/2; % Nyquist limit (Hz)
-f2 = fn - f1; % upper pass-band limit
-N = 2^(nextpow2(8*M)); % large FFT for interpolated display
-k1 = round(N*f1/fs); % lower band edge in bins
-if k1<2, k1=2; end; % cannot have dc or fn response
-kn = N/2 + 1; % bin index at Nyquist limit (1-based)
-k2 = kn-k1+1; % high-frequency band edge
-f1 = k1*fs/N % quantized band-edge frequencies
-f2 = k2*fs/N
-w = kaiser(M,beta)'; % Kaiser window in "linear phase form"
-H = [ ([0:k1-2]/(k1-1)).^8,ones(1,k2-k1+1),...
- ([k1-2:-1:0]/(k1-1)).^8, zeros(1,N/2-1)];
-h = ifft(H); % desired impulse response
-hodd = imag(h(1:2:N)); % This should be zero
-
-% put window in zero-phase form:
-wzp = [w((M+1)/2:M), zeros(1,N-M), w(1:(M-1)/2)];
-hw = wzp .* h; % single-sideband FIR filter, zero-centered
-Hw = fft(hw);
-hh = [hw(N-(M-1)/2+1:N),hw(1:(M+1)/2)]; % causal FIR
-hh *= 2;
-
-figure(1);
-HH = fft([hh,zeros(1,N-M)]);
-plot(20*log10(abs(HH)));
-figure(2);
-subplot(211); plot(real(hh)); title('real imp resp');
-subplot(212); plot(imag(hh)); title('imag imp resp');
-
-% save coeffs to a C header file
-
-f=fopen("../src/ht_coeff.h","wt");
-fprintf(f,"/* Hilbert Transform FIR filter coeffs */\n");
-fprintf(f,"/* Generated by make_hilb Octave script */\n");
-
-fprintf(f,"\n#define HT_N %d\n\n", M);
-
-fprintf(f,"COMP ht_coeff[]={\n");
-for r=1:M
- if r < M
- fprintf(f, " {%f,%f},\n", real(hh(r)), imag(hh(r)));
- else
- fprintf(f, " {%f,%f}\n};", real(hh(r)), imag(hh(r)));
- end
-end
-
-fclose(f);