From: yoann06 on 23 Jun 2010 08:30 Dear all, I am a new user of matlab. and as I dont have acces to all the tool boxes, I would like to write my own autocorrelation function. I have a discrete time series, and I would like to calculate the autocorrelation between 2 values of this series with a time lag of 1. this to enhance seasonal variations. I have very basic knowledge in programing, so if anyone have already write this kind of script, and would like to share it, it will be very appriciated. all kind of help or obviously welcome, thank you in advance, best regards Yoann
From: Wayne King on 23 Jun 2010 08:40 yoann06 <ydrocourt(a)gmail.com> wrote in message <440eb778-6754-4ea1-8183-144bfeac7ccf(a)e5g2000yqn.googlegroups.com>... > Dear all, > I am a new user of matlab. and as I dont have acces to all the tool > boxes, I would like to write my own autocorrelation function. > I have a discrete time series, and I would like to calculate the > autocorrelation between 2 values of this series with a time lag of 1. > this to enhance seasonal variations. > I have very basic knowledge in programing, so if anyone have already > write this kind of script, and would like to share it, it will be very > appriciated. all kind of help or obviously welcome, > thank you in advance, > best regards > Yoann You say you don't have access to all toolboxes. Do you have the Signal Processing Toolbox? Wayne
From: yoann06 on 23 Jun 2010 08:57 On 23 June, 13:40, "Wayne King" <wmkin...(a)gmail.com> wrote: > yoann06 <ydroco...(a)gmail.com> wrote in message <440eb778-6754-4ea1-8183-144bfeac7...(a)e5g2000yqn.googlegroups.com>... > > Dear all, > > I am a new user of matlab. and as I dont have acces to all the tool > > boxes, I would like to write my own autocorrelation function. > > I have a discrete time series, and I would like to calculate the > > autocorrelation between 2 values of this series with a time lag of 1. > > this to enhance seasonal variations. > > I have very basic knowledge in programing, so if anyone have already > > write this kind of script, and would like to share it, it will be very > > appriciated. all kind of help or obviously welcome, > > thank you in advance, > > best regards > > Yoann > > You say you don't have access to all toolboxes. Do you have the Signal Processing Toolbox? > > Wayne Hi Wayne, No unfortunately I don t
From: Wayne King on 23 Jun 2010 09:25 yoann06 <ydrocourt(a)gmail.com> wrote in message <dc1a1d27-6898-440c-b58a-44a6a76c3271(a)d37g2000yqm.googlegroups.com>... > On 23 June, 13:40, "Wayne King" <wmkin...(a)gmail.com> wrote: > > yoann06 <ydroco...(a)gmail.com> wrote in message <440eb778-6754-4ea1-8183-144bfeac7...(a)e5g2000yqn.googlegroups.com>... > > > Dear all, > > > I am a new user of matlab. and as I dont have acces to all the tool > > > boxes, I would like to write my own autocorrelation function. > > > I have a discrete time series, and I would like to calculate the > > > autocorrelation between 2 values of this series with a time lag of 1. > > > this to enhance seasonal variations. > > > I have very basic knowledge in programing, so if anyone have already > > > write this kind of script, and would like to share it, it will be very > > > appriciated. all kind of help or obviously welcome, > > > thank you in advance, > > > best regards > > > Yoann > > > > You say you don't have access to all toolboxes. Do you have the Signal Processing Toolbox? > > > > Wayne > > Hi Wayne, > No unfortunately I don t Hi Yoann: % x is your signal % numLags is the number of lags you want, e.g. 50 x = detrend(x,0); xmagDFT = abs(fft(x)).^2; autocorr = ifft(xmagDFT,'symmetric'); autocorr= autocorr(1:numLags); % normalize the autocorrelation you may or may not want this autocorr = autocorr./autocorr(1); % Example with white noise reset(RandStream.getDefaultStream); x = randn(512,1); numLags = 50; x = detrend(x,0); xmagDFT = abs(fft(x)).^2; autocorr = ifft(xmagDFT,'symmetric'); autocorr= autocorr(1:numLags); % normalize the autocorrelation autocorr = autocorr./autocorr(1); stem(autocorr); Hope that helps, Wayne
From: yoann06 on 24 Jun 2010 07:09 On 23 June, 14:25, "Wayne King" <wmkin...(a)gmail.com> wrote: > yoann06 <ydroco...(a)gmail.com> wrote in message <dc1a1d27-6898-440c-b58a-44a6a76c3...(a)d37g2000yqm.googlegroups.com>... > > On 23 June, 13:40, "Wayne King" <wmkin...(a)gmail.com> wrote: > > > yoann06 <ydroco...(a)gmail.com> wrote in message <440eb778-6754-4ea1-8183-144bfeac7...(a)e5g2000yqn.googlegroups.com>... > > > > Dear all, > > > > I am a new user of matlab. and as I dont have acces to all the tool > > > > boxes, I would like to write my own autocorrelation function. > > > > I have a discrete time series, and I would like to calculate the > > > > autocorrelation between 2 values of this series with a time lag of 1. > > > > this to enhance seasonal variations. > > > > I have very basic knowledge in programing, so if anyone have already > > > > write this kind of script, and would like to share it, it will be very > > > > appriciated. all kind of help or obviously welcome, > > > > thank you in advance, > > > > best regards > > > > Yoann > > > > You say you don't have access to all toolboxes. Do you have the Signal Processing Toolbox? > > > > Wayne > > > Hi Wayne, > > No unfortunately I don t > > Hi Yoann: > > % x is your signal > % numLags is the number of lags you want, e.g. 50 > x = detrend(x,0); > xmagDFT = abs(fft(x)).^2; > autocorr = ifft(xmagDFT,'symmetric'); > autocorr= autocorr(1:numLags); > % normalize the autocorrelation you may or may not want this > autocorr = autocorr./autocorr(1); > > % Example with white noise > > reset(RandStream.getDefaultStream); > x = randn(512,1); > numLags = 50; > x = detrend(x,0); > xmagDFT = abs(fft(x)).^2; > autocorr = ifft(xmagDFT,'symmetric'); > autocorr= autocorr(1:numLags); > % normalize the autocorrelation > autocorr = autocorr./autocorr(1); > stem(autocorr); > > Hope that helps, > Wayne- Hide quoted text - > > - Show quoted text - Yes thank you, it seems to give the right autoccorrelation pic. very nice all the best Yoann
|
Pages: 1 Prev: Add / Genpath without overwrite? Next: Sharing a function between classes |