Smoothing the data for different windowsizes (for loop)

4 visualizaciones (últimos 30 días)
Pree
Pree el 25 de Ag. de 2015
Comentada: Pree el 25 de Ag. de 2015
I have a for loop for different windowsize to smooth the data.
My m file first reads the xlsx file that I want to smooth. Then I have the windowsize for loop which looks like this:
for windowsize=[1,5:5:180]
...
%%%here there are various calculations that I want to do for each windowsize
...
%%%right at the bottom of the mfile there is end for the windowsize loop.
end
I get different results when I just use a particular windowsize (eg for windowsize=100) than when I use the for loop for lots of windowsize (eg for windowsize=[1,5:5:180])
It differs hugely when the windowsize is large.
Is it because I am smoothing the data that I have already smoothed with the previous windowsize?
But within the windowsize for loop, I have added a line which has the raw data so after it is done with the first windowsize, it should return back to the raw data and smooth it with the next windowsize.
I don't know what else would affect the results.
  2 comentarios
Walter Roberson
Walter Roberson el 25 de Ag. de 2015
We are going to need your code. If it is large then use the paperclip to attach it.
Pree
Pree el 25 de Ag. de 2015
here is the file

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de Ag. de 2015
I suggest you move the body of the loop into a new routine and pass appropriate values to it, and return the necessary values. That way you know that any variables that are local to the new function are going to be reset each time the function is called.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by