Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Moving average

  • CSPM includes a function that will create a moving average.
  • Start CSPM (to add the folder to the path)
  • Load the variable into matlab; Import data, and select an excel or text file.
  • Get the variable name of the timetrend
  • Set the number of samples over which to calculate the average
>> num_samples4window = 20;
  • Run the following command
    • "t" is the name of the timetrend variable in matlab workspace
>> tma = movingaverage( t, num_samples4window )

The filtered timetrend is saved in the variable "tma"

To view the results, run the following commands:

>> figure('Name','Before/after smoothing')
>> plot(t,'b')
>> hold on
>> plot(tma,'r')
>> legend {'Original' 'Smoothed'}

 

  • No labels