Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/fromFSfcn.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 % FROMFSFCN Construct an ao from a fs-function string | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % FUNCTION: fromFSfcn | |
5 % | |
6 % DESCRIPTION: Construct an ao from a fs-function string | |
7 % | |
8 % CALL: a = fromFSfcn(a, pl) | |
9 % | |
10 % PARAMETER: pl: Parameter list object | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 function a = fromFSfcn(a, pli) | |
14 | |
15 import utils.const.* | |
16 | |
17 VERSION = '$Id: fromFSfcn.m,v 1.24 2011/08/12 12:25:26 hewitson Exp $'; | |
18 % get AO info | |
19 ii = ao.getInfo('ao', 'From Frequency-series Function'); | |
20 | |
21 % Set the method version string in the minfo object | |
22 ii.setMversion([VERSION '-->' ii.mversion]); | |
23 | |
24 % Add default values | |
25 pl = applyDefaults(ii.plists, pli); | |
26 pl.getSetRandState(); | |
27 f = find(pl, 'f'); | |
28 | |
29 if isempty(f) | |
30 utils.helper.msg(msg.PROC2, 'generating f vector'); | |
31 f1 = find(pl, 'f1'); | |
32 f2 = find(pl, 'f2'); | |
33 nf = find(pl, 'nf'); | |
34 scale = find(pl, 'scale'); | |
35 switch lower(scale) | |
36 case 'log' | |
37 f = logspace(log10(f1), log10(f2), nf); | |
38 case 'lin' | |
39 f = linspace(f1, f2, nf); | |
40 otherwise | |
41 error('### Unknown frequency scale specified'); | |
42 end | |
43 elseif isa(f, 'ao') | |
44 f = f.data.getX; | |
45 end | |
46 | |
47 % Get the function | |
48 fcn = find(pl, 'fsfcn'); | |
49 | |
50 % make y data | |
51 y = eval([fcn ';']); | |
52 | |
53 fs = fsdata(f,y); | |
54 | |
55 % Make an analysis object | |
56 a.data = fs; | |
57 | |
58 % Add history | |
59 a.addHistory(ii, pl, [], []); | |
60 | |
61 % set x and y units | |
62 a.setXunits(pl.find('xunits')); | |
63 a.setYunits(pl.find('yunits')); | |
64 | |
65 % Set object properties from the plist | |
66 a.setObjectProperties(pl); | |
67 | |
68 end | |
69 |