[Scilab-users] efficient calculation for a moving window

fujimoto2005 fujimoto2005 at gmail.com
Sat Mar 25 07:49:15 CET 2017


Suppose x is a 1*n vector and m<n.
Define a new 1*(n-m+1) vector y whose i-th element y(i)=f(x(i:i-1+m)) where
f() is a single valued function.The straight code to construct y is as
follows.

y=zeros(1,n-m+1);
for i=1:n-m+1
	y(i)=f(x(i:i-1+m))
end 

Is there any code without for-end loop?

Best regards




--
View this message in context: http://mailinglists.scilab.org/efficient-calculation-for-a-moving-window-tp4035997.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list