Documentation of regress_ceof


Global Index (short | long) | Local contents | Local Index (short | long)


Function Synopsis

[out, ccoef] = regress_ceof(temp, pcs, nfrm, num);

Help text


  [out, temtim] = regress_ceof(dat, pcs, nfrm);


Cross-Reference Information

This function calls This function is called by

Listing of function regress_ceof

function [out, ccoef] = regress_ceof(temp, pcs, nfrm, num);

if nargin < 2;
  error('There must be at least 2 inputs, ''dat'' and ''pcs'' ');
elseif nargin < 3;
  num = 1;
  nfrm = 6;
elseif nargin < 4;
  num = 1;
end

sz_temp = size(temp);
ndim = length(sz_temp);
[temp, tem] = remove_mean(temp);

lag = 0; lg = lag*pi/180; lg2 = 1;

j = sqrt(-1);
timeseries = sqrt(2)*pcs(:,num)./std(pcs(:,num));
temp = reshape(temp, sz_temp(1), prod(sz_temp(2:ndim)));
stdtemp = std(temp);

clear temtim treg
for i = 1:nfrm
  wgt = conj(exp(j * ((i-1) * pi/(lg2*nfrm) + lg) ));
  temtim(:,i) = squeeze(real(wgt .* timeseries));
  out(i, :) = temtim(:,i)' * temp ./ sz_temp(1);
  ccoef(i, :) = out(i, :) ./ stdtemp;
end
out = reshape(out, [nfrm sz_temp(2:ndim)]);
ccoef = reshape(ccoef, [nfrm sz_temp(2:ndim)]);