From: marvin on 4 Mar 2010 07:05 Hello people I stumbled upon some strange behaviour of the decimate()-Function. If I want to decimate a constant signal, I can assume that the decimated result reaches the same level? Than why is this not happening? Where didn't I get it? x=[[0:1000] 1000*ones(1,100)]; y1=decimate(x,2); y2=downsample(x,2); clf;hold on; plot(x,'g'); plot(y1,'r'); plot(y2,'b'); hold off; This is just a quick and dirty hack -- enough to show what I mean. Thanks and greetings!
From: us on 4 Mar 2010 07:21 "marvin" <mzenzes(a)mega2000.de> wrote in message <hmo7m2$7gk$1(a)fred.mathworks.com>... > Hello people > > I stumbled upon some strange behaviour of the decimate()-Function. If I want to decimate a constant signal, I can assume that the decimated result reaches the same level? Than why is this not happening? Where didn't I get it? > > x=[[0:1000] 1000*ones(1,100)]; > y1=decimate(x,2); > y2=downsample(x,2); > clf;hold on; > plot(x,'g'); > plot(y1,'r'); > plot(y2,'b'); > hold off; > > This is just a quick and dirty hack -- enough to show what I mean. > > Thanks and greetings! well, does a careful look at help decimate; help downsample; % not tell you the reason for your observation(?)... us
From: Wayne King on 4 Mar 2010 07:28 "marvin" <mzenzes(a)mega2000.de> wrote in message <hmo7m2$7gk$1(a)fred.mathworks.com>... > Hello people > > I stumbled upon some strange behaviour of the decimate()-Function. If I want to decimate a constant signal, I can assume that the decimated result reaches the same level? Than why is this not happening? Where didn't I get it? > > x=[[0:1000] 1000*ones(1,100)]; > y1=decimate(x,2); > y2=downsample(x,2); > clf;hold on; > plot(x,'g'); > plot(y1,'r'); > plot(y2,'b'); > hold off; > > This is just a quick and dirty hack -- enough to show what I mean. > > Thanks and greetings! Hi Marvin, That difference in behavior is fully expected. You have to keep in mind that decimate() is applying a lowpass filter. So decimation by a factor of two is the equivalent of convolving the input with a lowpass filter, and downsampling that convolution by two. On the other hand, downsample() merely downsamples the input (without filtering). Assume you use the default phase in downsample: x=1:32; downsample(x,2) Note the outputs are integers and that each index in the output sequence is only affected by one index in the input, i.e. the 1st element of the downsampled sequence (output) only depends on the 1st element of the input, the 2nd element of the downsampled sequence only depends on the 3rd element of the input, and so on. Now look at x=1:32; decimate(x,2) Note the outputs are no longer integers. This is because each element of the output depends on more than one element in the input and the filter through convolution. Hope that helps, Wayne
From: marvin on 4 Mar 2010 08:59 Hey Wayne, > Now look at > x=1:32; > decimate(x,2) > > Note the outputs are no longer integers. This is because each element of the output depends on more than one element in the input and the filter through convolution. > Ok, this is what the documentation says... But when I lowpass a constant signal/value -- like in my example 1000 -- shouldn't the lowpass filter reach 1000 aswell (after a specific time)? So in this example here, the lowpass-filter has a gain smaller than 1, which is not what i expected.
|
Pages: 1 Prev: nlarx model by using sigmoid function Next: LSQCURVEFIT bounds |