Mercurial > hg > ltpda
comparison m-toolbox/test/test_phasetrack.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function test_phasetrack() | |
2 % TEST_PHASETRACK tests phasetrack() | |
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
4 % | |
5 % DESCRIPTION: test of phasetracking for atan()-output | |
6 % | |
7 % | |
8 % CALL: test_phasetrack; | |
9 % | |
10 % HISTORY: 16-05-2008 Monsky | |
11 % Creation. | |
12 % | |
13 % VERSION: % $Id: test_phasetrack.m,v 1.1 2008/05/21 09:53:46 anneke Exp $ | |
14 % | |
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
16 | |
17 % Create tsdata with a sinewave | |
18 pl = plist(); | |
19 pl = append(pl, param('fs', 100)); | |
20 pl = append(pl, param('nsecs', 5)); | |
21 pl = append(pl, param('waveform', 'sine wave')); | |
22 pl = append(pl, param('f', 0.2)); | |
23 pl = append(pl, param('phi', 0)); | |
24 | |
25 % Create an original time series with range bigger than +-PI | |
26 original_data = 3*pi*ao(pl); | |
27 | |
28 % generate time series from original data as measured by phasemeter | |
29 % if phasemeter uses atan() instead of atan2() for phase calculation | |
30 | |
31 pm_data=atan(tan(original_data)); | |
32 | |
33 % apply phase tracking algorithm | |
34 | |
35 tracked_data=phasetrack(pm_data); | |
36 | |
37 iplot(original_data, pm_data, tracked_data, (original_data-tracked_data)); | |
38 legend 'original data' 'phasemeter output data' 'phase-tracked data' 'diff (original-tracked data)' | |
39 | |
40 plot(tracked_data.hist) | |
41 % figure | |
42 % subplot(2,2,1) | |
43 % plot(original_data) | |
44 % subplot(2,2,2) | |
45 % plot(pm_data) | |
46 % subplot(2,2,3) | |
47 % plot(tracked_data) | |
48 % subplot(2,2,4) | |
49 % plot((original_data-tracked_data)) |