4
$\begingroup$

I have 2 arrays of 800000 input and output data samples. The system is a kind of oven that works from 0 to 10 volts. The sample time is 0.001s.

I have to identify the model of this system, but first of all, given that the data are clearly dirty, I would like to filter the noise.

  • How can I do it with the System Identification Toolbox of MATLAB?

  • Moreover, how can I estimate the cutoff frequency to remove the noise?

EDIT:

As suggested, here below are the sampled data plot. As you can see the voltage inputs looks good, but the temperature outputs are affect of noise. I would like to remove it, in order have the output more "smooth".

enter image description here

$\endgroup$
  • $\begingroup$ did you even bother googling it ? have a look at one Matlab System Identification Example ccrma.stanford.edu/~jos/fp/… $\endgroup$ – Sufiyan Ghori Mar 22 '13 at 10:47
  • $\begingroup$ Yes I did. I've seen the filter option under preprocess menu but, as I stated, I don't know which value to put as cutoff frequency. Even because, I cannot use the Nyquist theorem, given that I have too many samples and obviously the sampling time should be lower than 0.001 seconds for such system. $\endgroup$ – Daniele Vitali Mar 22 '13 at 10:57
  • $\begingroup$ It would probably help if you posted a plot of your data and describe what you expect to see in the data. $\endgroup$ – Jim Clay Mar 22 '13 at 13:01
  • $\begingroup$ @JimClay here they are :) $\endgroup$ – Daniele Vitali Mar 22 '13 at 14:08
  • $\begingroup$ you should start playing with 1-D wavelet toolbox i guess. $\endgroup$ – Sufiyan Ghori Mar 22 '13 at 15:03
1
$\begingroup$

There are two sources of errors that cause the temperature reading to look different than the voltage reading: sensor error and temperature error. You want to get rid of the sensor error and keep the temperature error. I would surmise that the high-frequency spikes are sensor error, and everything else is temperature error.

I would do it like this- plot the power of the voltage input in the frequency domain (e.g. plot(20*log10(abs(fft(voltInput)))) in MATLAB). It will have power across the entire frequency spectrum, but should be concentrated primarily in the lower frequencies. Figure out a cutoff point that will preserve most of your "signal" (voltage input) but should also get rid of most of your noise. I'm guessing that the oven acts like a low-pass filter (takes time for it to change temperature), so this shouldn't affect the true temperature reading much. You could verify this by doing a similar plot of the temperature reading. I bet the high-frequency signal content is quite attenuated. Setting your cutoff point to somewhere in that attenuated region would be a good choice.

You can also adjust your cutoff frequency and empirically see how that affects the results.

$\endgroup$
  • $\begingroup$ Thank you for your replay. I have plotted the input as you suggested. The input spectrum has dominant values in low and high frequencies, and the output as well (with some differences in the middle). However cutting at 0.5Hz the output is improved but not the input (there are elongations on the initial and filan step). I don't understand why filter also the input. The voltage inputs looks clear without noise, aren't they? And do you think that I should downsample the data before start the identification process given that 800000 samples with 0.001 sample time are too many? Thank you :) $\endgroup$ – Daniele Vitali Mar 22 '13 at 16:45
  • $\begingroup$ You don't need to filter the input. The point of looking at the input was just to figure out what a good cutoff frequency would be. Yes, downsampling wouldn't be a bad idea. In fact, if you downsample to a reasonable sample rate using Matlab's "decimate" command, that would probably take care of the noise problem for you. $\endgroup$ – Jim Clay Mar 22 '13 at 17:23
  • $\begingroup$ I think that the "high values" that you are talking about are the low negative frequencies, not the high frequencies. The "middle values" would then be the high frequencies. Do "plot(20*log10(fftshift(abs(fft(voltInput)))))" to have the low frequencies in the middle, and the high frequencies on the far right and far left. $\endgroup$ – Jim Clay Mar 22 '13 at 19:52
  • $\begingroup$ Ok the new plot shows as you said now. I was wondering does periodogram function plot the same graph as yours? And one more question.. Is there a way to set the downsampling factor for the decimate function that avoid aliasing effect on the data? Thank you for your time :) $\endgroup$ – Daniele Vitali Mar 23 '13 at 10:30
  • $\begingroup$ I've never used the periodogram function, but according to its description it sounds like it is the same thing. The decimate function automatically applies an anti-aliasing filter so you shouldn't need to worry about that. If you are going to downsample by a large factor (e.g. 500) it's usually a good idea to break it up into multiple smaller decimates (e.g. 10, 10, 5) whose product is the downsample factor you want. $\endgroup$ – Jim Clay Mar 23 '13 at 15:25
4
$\begingroup$

You can try to remove noise (especially occasional spikes) by non-linear filter. I suggest to use median filter (http://en.wikipedia.org/wiki/Median_filter), as your spikes has length only few points (as I see). There is matlab function - medfilt1. It is probably that such filtration will be enough.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.