From: david t53 on 7 Jul 2010 09:59 > f = fdesign.bandpass(.35,.45,.55,.65,60,1,60); > Hd = design(f, 'equiripple') Hd = FilterStructure: 'Direct-Form FIR' Arithmetic: 'double' Numerator: [1x48 double] PersistentMemory: false > fvtool(Hd) As I have the Filter Design toolbox, I see the dashed red lines corresponding to the specification. Now, if I do > a = Hd.Numerator; > f2 = fdesign.bandpass(.35,.45,.55,.65,30,1,30); > Hd3 = design(f3, 'equiripple') > Hd.Numerator = Hd2.Numerator; > Hd.Numerator = a I get the same exact filter as above, I have not changed anything. However, if I plot it again: > fvtool(Hd) I don't get the dashed red lines anymore. Why? Where is the specification information saved in the Hd structure? I don't see it anywhere here. Hd = FilterStructure: 'Direct-Form FIR' Arithmetic: 'double' Numerator: [1x48 double] PersistentMemory: false How to display it? Regards, David
From: Wayne King on 7 Jul 2010 10:50 "david t53" <david_t53(a)sogetthis.com> wrote in message <i12178$f3s$1(a)fred.mathworks.com>... > > f = fdesign.bandpass(.35,.45,.55,.65,60,1,60); > > Hd = design(f, 'equiripple') > Hd = > FilterStructure: 'Direct-Form FIR' > Arithmetic: 'double' > Numerator: [1x48 double] > PersistentMemory: false > > > fvtool(Hd) > > As I have the Filter Design toolbox, I see the dashed red lines corresponding to the specification. > > Now, if I do > > a = Hd.Numerator; > > f2 = fdesign.bandpass(.35,.45,.55,.65,30,1,30); > > Hd3 = design(f3, 'equiripple') > > Hd.Numerator = Hd2.Numerator; > > Hd.Numerator = a > > I get the same exact filter as above, I have not changed anything. > > However, if I plot it again: > > fvtool(Hd) > > I don't get the dashed red lines anymore. > > Why? > Where is the specification information saved in the Hd structure? > I don't see it anywhere here. > Hd = > FilterStructure: 'Direct-Form FIR' > Arithmetic: 'double' > Numerator: [1x48 double] > PersistentMemory: false > > How to display it? > > Regards, > David Hi David, the specification is in the filter specification object. Once you invoked the design method, you have a filter object. If you look at your filter specification object, you will see the specifications. There's actually a link between the designed filter (Hd in your example) and the filter specification object, f, so that if you enter: f = fdesign.lowpass; Hd = design(f); getfdesign(Hd) You will see what specification object is linked to your designed filter. If you were to change something in your designed filter object, Hd, you would break the link and getfdesign() would return an empty matrix. (For example, if you changed the value of one of the filter coefficients) Not sure what your comment about the missing design mask (red lines in fvtool) is. Your code example is incomplete: Here is your code: f = fdesign.bandpass(.35,.45,.55,.65,60,1,60); Hd = design(f, 'equiripple') fvtool(Hd) a = Hd.Numerator; f2 = fdesign.bandpass(.35,.45,.55,.65,30,1,30); Hd3 = design(f3, 'equiripple') Hd.Numerator = Hd2.Numerator; Hd.Numerator = a You don't have any specification object that is f3 and you don't design any Hd2, so this code will not run. I'm not sure what you are trying to show here, but if you run: % again I don't understand why someone would do this: f = fdesign.bandpass(.35,.45,.55,.65,60,1,60); Hd = design(f, 'equiripple') fvtool(Hd) a = Hd.Numerator; Hd.Numerator = a fvtool(Hd) You will see the design mask. However, if you do something to break the link between the designed filter and the specification object as I have shown above, you will not see the design mask anymore. Ex: f = fdesign.lowpass; Hd = design(f); fvtool(Hd); % breaking the link by changing a coefficient Hd.Numerator(1) = Hd.Numerator(1)+0.01; % now calling fvtool does not produce the mask fvtool(Hd); Hope that helps, Wayne
From: david t53 on 7 Jul 2010 13:22 > There's actually a link between the designed filter (Hd in your example) and the filter specification object, f, so that if you enter: > > f = fdesign.lowpass; > Hd = design(f); > getfdesign(Hd) Where is this "link" saved (in which variable)? >> f f = Response: 'Bandpass' Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2' Description: {7x1 cell} NormalizedFrequency: true Fstop1: 0.35 Fpass1: 0.45 Fpass2: 0.55 Fstop2: 0.65 Astop1: 60 Apass: 1 Astop2: 60 >> Hd Hd = FilterStructure: 'Direct-Form FIR' Arithmetic: 'double' Numerator: [1x48 double] PersistentMemory: false I don't see where is this link saved. It is not inside f, nor inside Hd structures. Is there an external variable that is saving those links? (and removing the links when Hd.Numerator changes) Regards, David
From: Wayne King on 7 Jul 2010 15:04 "david t53" <david_t53(a)sogetthis.com> wrote in message <i12d4c$j1i$1(a)fred.mathworks.com>... > > There's actually a link between the designed filter (Hd in your example) and the filter specification object, f, so that if you enter: > > > > f = fdesign.lowpass; > > Hd = design(f); > > getfdesign(Hd) > > Where is this "link" saved (in which variable)? > > >> f > f = > Response: 'Bandpass' > Specification: 'Fst1,Fp1,Fp2,Fst2,Ast1,Ap,Ast2' > Description: {7x1 cell} > NormalizedFrequency: true > Fstop1: 0.35 > Fpass1: 0.45 > Fpass2: 0.55 > Fstop2: 0.65 > Astop1: 60 > Apass: 1 > Astop2: 60 > >> Hd > Hd = > FilterStructure: 'Direct-Form FIR' > Arithmetic: 'double' > Numerator: [1x48 double] > PersistentMemory: false > > I don't see where is this link saved. It is not inside f, nor inside Hd structures. > > Is there an external variable that is saving those links? > (and removing the links when Hd.Numerator changes) > > > Regards, > David Hi David, the "link" is behind the scenes. That connection is only important in certain circumstances, like producing the mask. Otherwise, you have your filter specification object, and you have your filter object. Once you have designed your filter object, you are ready to apply it. You can use the measure() method to see how well your filter does. measure(Hd) Also, when you use fvtool(Hd), click on the "i" icon (filter information), all the necessary information about your filter including its specifications will appear. Wayne
|
Pages: 1 Prev: problem with importdata in a GUI Next: reading different structures |