File: undersample.m

package info (click to toggle)
codec2 0.9.2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 113,072 kB
  • sloc: ansic: 412,877; python: 4,004; sh: 1,540; objc: 817; asm: 683; makefile: 588
file content (26 lines) | stat: -rw-r--r-- 423 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
% undersample.m
% David Rowe 5 Nov 2012
% Testing algorithms for plotting undersampled data for fdmdv2 waveform displays

fs=fopen("../raw/hts1a.raw","rb");
s = fread(fs,Inf,"short");

Fs1=8000;
Fs2=200;

M=Fs1/Fs2;

samples=length(s)/M;
s1=zeros(1,2*samples);
for b=1:samples
    st = (b-1)*M + 1;
    en = b*M;
    s1(2*b-1) = max(s(st:en));
    s1(2*b) = min(s(st:en));
end

subplot(211)
plot(s)
subplot(212)
plot(s1);