-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathAnalogPhaseCalibrationFormat.m
47 lines (37 loc) · 1.21 KB
/
AnalogPhaseCalibrationFormat.m
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
classdef AnalogPhaseCalibrationFormat
% Copyright 2023 The MathWorks, Inc.
properties
PhaseSetting
Subarray1Measurements
Subarray2Measurements
end
methods
function s = toStruct(this)
s.PhaseSetting = this.PhaseSetting;
s.Subarray1Measurements = this.Subarray1Measurements;
s.Subarray2Measurements = this.Subarray2Measurements;
end
function [cal1,cal2] = getCalValues(this)
cal1 = this.sub1Cal();
cal2 = this.sub2Cal();
end
end
methods (Access = private)
function cal1 = sub1Cal(this)
cal1 = this.subCal(this.Subarray1Measurements);
end
function cal2 = sub2Cal(this)
cal2 = this.subCal(this.Subarray2Measurements);
end
function cal = subCal(this,data)
% Get signal amplitude
datafft = abs(fft(data));
amp = max(datafft,[],1);
% Get location of min amplitude
[~,phaseIdx] = min(amp,[],2);
% Get calibration phase
calPhase = wrapTo360(this.PhaseSetting(phaseIdx)-180);
cal = [0;calPhase.'];
end
end
end