[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do you pass two Octave functions to an .oct function?
From: |
babelproofreader |
Subject: |
Re: How do you pass two Octave functions to an .oct function? |
Date: |
Tue, 20 Oct 2009 05:58:08 -0700 (PDT) |
>Have you tried implementing this in Octave code (.m)?
Yes, I have; the code is below.
function smoothed_output=fastrollingfftlowpass(data,fre,wid)
%function y=fftlowpass(rolling_vector,fre,wid)
if(exist('wid')~=1) wid=0.2; endif
if(exist('fre')~=1) fre=0.05; endif
n=rows(data);
smoothed_output=data;
L=16;
L_2=L/2;
rolling_vector=zeros(L,1);
detrend_rolling_vector=zeros(L,1);
for (ii=L:n)
rolling_vector(1:L,1)=data(ii-(L-1):ii,1);
% detrend the rolling_vector %
intercept=rolling_vector(1,1);
slope=(rolling_vector(L,1)-intercept)/(L-1);
detrend_rolling_vector=detrend_vector(rolling_vector); % calls an .oct file
"detrend_vector"
% end of detrend code %
% the actual filter code %
Y2=fft(detrend_rolling_vector);
Y2=filter_fft_vector(Y2); % frequency domain filtering in .oct file
y2=real(ifft(Y2));
% end of filter code %
smoothed_output(ii,1)=y2(L)+intercept+(L-1)*slope;
endfor
I have utilised compiled .oct files where possible to speed up the function.
--
View this message in context:
http://www.nabble.com/How-do-you-pass-two-Octave-functions-to-an-.oct-function--tp25870717p25974615.html
Sent from the Octave - General mailing list archive at Nabble.com.
- How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/13
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/14
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/15
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/16
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/16
- Re: How do you pass two Octave functions to an .oct function?, David Grundberg, 2009/10/18
- Re: How do you pass two Octave functions to an .oct function?,
babelproofreader <=
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/20
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/21
- Re: How do you pass two Octave functions to an .oct function?, Jaroslav Hajek, 2009/10/22
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/25
- Re: How do you pass two Octave functions to an .oct function?, David Grundberg, 2009/10/25
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/26
- Re: How do you pass two Octave functions to an .oct function?, babelproofreader, 2009/10/29