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

📄 phscram.m

📁 biomedical stuffs...
💻 M
字号:
function  [xscram,xftscr]=phscram(x)
%  [xscram,xftscr]=phscram(x)
%  scrambles a data file using uniform random numbers to generate indices
%  randomly re-arranges the phase of the fft
%  works with vectors only
%
%	This program is distributed as a supplement to the book
%	"Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
%	published by Wiley, 2000.  It is provided for educational use only.
%  While every effort has been made to insure its suitability to illustrate
%  principles described in the above book, no specific feature or capability 
%  is implied or guaranteed.
xft=fft(x);magxft=abs(xft);phxft=angle(xft);
%xscram=zeros(size(phxft));
kl=length(phxft);
rand('seed',sum(100*clock)); phscr=(rand(kl,1)-0.5)*2*pi;
for j=2:kl/2
	phscr(kl+2-j)=-phscr(j);
end
phscr(1)=0;
phscr(kl/2+1)=0;phscr(kl/2)=0;
xftscr=magxft.*exp(phscr*i);
xscram=ifft(xftscr);
%previous code for randomizing sign of phase
%for j=1:kl
%	rx=rand;
%	xscram(j)=phxft(j)*sign(rx-0.5);
%end   % of main for loop

⌨️ 快捷键说明

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