Hi;
First off your Matlab code appears wrong because a variable name cannot contain an dash (-).
I think your function can be run in Scilab by a little modifications. So use xcorr() and xcov() instead autocorr() and cov(), respectively. See:
https://help.scilab.org/docs/current/en_US/xcorr.html and
https://help.scilab.org/docs/current/en_US/xcov.html
Also we can define a function in Scilab as follows:
function spectrum = spectrum-calc(data,freq,n-lags,M)
// body of the function
endfuncrion
You may need to import some data into Scilab environment, so read() function can be handy. For instance suppose we wanna load a DAT file downloaded from a website (e.g.
ftp://ftp.esat.kuleuven.be/pub/SISTA/data/process_industry/powerplant.dat.gz).
So just try this:
pathname = "PATH_TO_THE_FILE";
data=read(pathname + "powerplant.dat",-1,11);
//Also You can classify your data:
u=data(:,1:5); y=data(:,6:8); yr=data(:,9:11);
HTH
Mehran
_