⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sg.m

📁 这里面包含源数多于传感器数的文章和相关源代码。
💻 M
字号:
function [yo,fo,to] = sg(x,nfft,Fs,WINDOW,noverlap)nx = length(x);nwind = length(WINDOW);if nx < nwind    % zero-pad x if it has length less than the window length    x(nwind)=0;  nx=nwind;endx = x(:); % make a column vector for ease laterWINDOW = WINDOW(:); % be consistent with data setncol = fix((nx-noverlap)/(nwind-noverlap));colindex = 1 + (0:(ncol-1))*(nwind-noverlap);rowindex = (1:nwind)';if length(x)<(nwind+colindex(ncol)-1)    x(nwind+colindex(ncol)-1) = 0;   % zero-pad xendy = zeros(nwind,ncol);y(:) = x(rowindex(:,ones(1,ncol))+colindex(ones(nwind,1),:)-1);y = WINDOW(:,ones(1,ncol)).*y;y = fft(y,nfft);if ~any(any(imag(x)))    % x purely real    if rem(nfft,2),    % nfft odd        select = [1:(nfft+1)/2];    else        select = [1:nfft/2+1];    end    y = y(select,:);else    select = 1:nfft;endf = (select - 1)'*Fs/nfft;t = (colindex-1)'/Fs;if nargout == 1,    yo = y;elseif nargout == 2,    yo = y;    fo = f;elseif nargout == 3,    yo = y;    fo = f;    to = t;end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -