T O P I C R E V I E W |
Sarath_2010 |
Posted - 06/28/2013 : 11:13:13 AM I wanted to perform simple moving average of a column data. For instance, for 5 point moving average, the fifth row of the result column should be the average of the first five rows of the data column, the sixth row of the result column should be the average of row 2 to row 6 of the data column and so on. This can be easily performed in Excel, but I find it impossible in Origin. Please help.
A similar problem is to find the exponential moving averages of a column data, popular in financial markets. Any suggestions?
Thanks in advance! |
14 L A T E S T R E P L I E S (Newest First) |
fusjen63 |
Posted - 12/07/2015 : 08:06:39 AM Hi,
Yes it works !! Thanks a lot !
|
Hideo Fujii |
Posted - 12/04/2015 : 4:21:37 PM Hi,
I have checked again to see whether it works on my Origin 8.5 (SR1, b161), or not. This shouldn't matter whether Origin is Pro or not. It worked as below. How did you run the script?
To run the script, 1) Make sure, your workbook is activated as selected in front. 2) Open the Script window, and copy-and-paste the script into the Script window. 3) Highlight ALL lines of the script, and hit ENTER key to run the selection.
Hope the problem is straighten out now.
--Hideo Fujii OriginLab |
fusjen63 |
Posted - 12/04/2015 : 04:53:08 AM HI,
Stil does not work.. I really do not understand why since I have no code error but looks like it does not manage to deal with index.
I tried on different version of origin (7 and 8pro) on my collegues computer but same conclusions. MOreover i do not find standard deviation function in previous version.
Thanks |
Hideo Fujii |
Posted - 12/03/2015 : 3:20:25 PM Hi,
This should work though it might slow down the speed: for (i=1; i<12; i+=4) {
range aa = 1[i]:1[i+3];
range bb = 2[i];
//bb = Stddev(aa);
sum(aa);
bb=sum.sd;
} --Hideo Fujii OriginLab
|
fusjen63 |
Posted - 12/03/2015 : 03:45:44 AM It does not work with my version.. (Origin 8.5 Academic) |
snowli |
Posted - 12/02/2015 : 12:40:36 PM Just remove ; at the end of for loop. The folloing works.
for (i=1; i<12; i+=4) { range aa = 1[i]:1[i+3]; range bb = 2[i]; bb = Stddev(aa); }
Thanks, Snow |
fusjen63 |
Posted - 12/02/2015 : 12:17:42 PM OUPS I meant standard deviation not average |
fusjen63 |
Posted - 12/02/2015 : 12:11:32 PM Ok thank you for your answer. I actually tried to use LT but do not understand why, do not work. I wrote this in the script window :
"for (i=1; i<12; i+=4); { range aa = 1[i]:1[i+3]; range bb = 2[i]; bb = Stddev(aa); };"
I want to average block of 4 cells, along all my column 1(12rows) and put the value in column 2 at the first line of the cells block.
When I execute i do not have error message but only got double dash line in the column 2...
Thanks for your help
|
snowli |
Posted - 12/01/2015 : 2:32:40 PM Hello,
Since Origin 9.1, we supports subrange notation in Set Column Values, so that you can easying doing moving calculations.
E.g. the following will do moving standard deviation of range of cells from 5 above the current cell to 5 after the current cell. stddev(col(A)[i-5:i+5])
In your version, you may need to write LT script to loop through all rows to get moving standard deviation.
Thanks, Snow Li OriginLab Corp. |
fusjen63 |
Posted - 12/01/2015 : 12:05:11 PM Hello,
How can I manage to get moving standard deviation with Origin 8.5 please ? I've tried different things with windows commande but do not seem to work..
Thanks in advance |
Sam Fang |
Posted - 07/07/2013 : 10:56:35 PM Exponential moving average can also be done in Origin.
Suppose you want to perform exponential moving average on Column B with time period of 10. You can right click on Column C, and select Set Column Values from the shortcut menu. In the Set Values dialog, make following settings:
Then exponential moving average data will be shown in Column C. For other time period values, you need change the value 10 and 11 to other specified values in Before Formula Scripts and From value at the top of the dialog.
Sam OriginLab Technical Services |
snowli |
Posted - 06/28/2013 : 5:32:38 PM Hello,
There is LabTalk Script on this page http://www.originlab.com/www/support/resultstech.aspx?ID=298&language=English
You can use it to calculate Moving Average.
Thanks, Snow |
Sarath_2010 |
Posted - 06/28/2013 : 4:20:05 PM I am using Origin 8.0. Is there any way out? |
snowli |
Posted - 06/28/2013 : 11:59:54 AM Hello,
Which Origin version are you using?
We added single moving average in Origin 9.0.
You can add a new column. Then in Set Column Values dialog, find the function from F(x): Statistics: movavg()
You can set the formula to be movavg(col(A), 2, 2) to get moving average of 5 points. 1st 2 is 2 points before current point. 2nd 2 is 2 points after the point.
We don't have exponential moving averaging yet but maybe you can use formulas after calculating simple moving average to get exponential moving averaging. We will investigate EMA further and hopefully add it in future version.
Thanks, Snow Li OriginLab Corp. |