Commit ad185c3e0a3b2b5ba21ba90517c492f92bef8f90
1 parent
b12d75282c
Exists in
FMCW
Add file and change README
Showing 2 changed files with 40 additions and 0 deletions Inline Diff
README
View file @
ad185c3
1 | We recommend you to install pahsed array system toolbox for MATLAB 2018. | |||
2 | Load samples and demodulate using "load_data.m". | |||
3 | You can generate your own FMCW signal using FMCWWaveform() on Matlab. |
load_samples.m
View file @
ad185c3
File was created | 1 | function [samples, n_samples] = load_samples(samplefilepath, format, little_endian, nr) | ||
2 | %%%%%%%%%%%%%%%%%%%%%% | |||
3 | %% read the samples | |||
4 | %%%%%%%%%%%%%%%%%%%%%% | |||
5 | ||||
6 | if nargin < 4 | |||
7 | nr = inf; | |||
8 | end | |||
9 | if nargin > 1 && strcmp(format,'cplx') | |||
10 | fid = fopen(samplefilepath, 'r'); | |||
11 | if (nargin < 3) | |||
12 | little_endian = false; | |||
13 | end | |||
14 | if (little_endian) | |||
15 | [s, n] = fread(fid, nr, 'int32', 0, 'ieee-le'); | |||
16 | else | |||
17 | [s, n] = fread(fid, nr, 'int32', 0, 'ieee-be'); | |||
18 | end | |||
19 | fclose(fid); | |||
20 | s = reshape(s, 2, []).'; | |||
21 | s = s(:,1) + 1i * s(:,2); | |||
22 | n = n/2; | |||
23 | end | |||
24 | ||||
25 | if nargin > 1 && strcmp(format,'float32') | |||
26 | fid = fopen(samplefilepath, 'r'); | |||
27 | [s, n] = fread(fid, nr, 'float'); | |||
28 | fclose(fid); | |||
29 | s = reshape(s, 2, []).'; | |||
30 | s = s(:,1) + 1i * s(:,2); | |||
31 | n = n/2; | |||
32 | end | |||
33 | ||||
34 | s(1:10,:) |