Smoothing the data for different windowsizes (for loop)

3 Ansichten (letzte 30 Tage)
Pree
Pree am 25 Aug. 2015
Kommentiert: Pree am 25 Aug. 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 Kommentare
Walter Roberson
Walter Roberson am 25 Aug. 2015
We are going to need your code. If it is large then use the paperclip to attach it.
Pree
Pree am 25 Aug. 2015
here is the file

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 25 Aug. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by