📄 resamp.m,v
字号:
head 3.0;access;symbols;locks; strict;comment @// @;3.0date 2000.06.13.19.21.10; author gilles; state Exp;branches;next 2.0;2.0date 99.05.21.18.46.19; author mah; state Exp;branches;next 1.2;1.2date 99.05.21.15.06.44; author mah; state Exp;branches;next 1.1;1.1date 99.02.02.15.31.25; author perron; state Exp;branches;next ;desc@Resampling function for DSISoft@3.0log@Release 3@text@function [dataout]=resamp(datain,smp_rate)%This function resamples a DSI variable dataset %to a user specified sampling rate. The ratio%of the new sampling over the old must be an integer%%function [dataout]=resamp(datain,smp_rate)%%Input variables%datain - DSI variable dataset to be resampled%smp_rate - new user specified sampling rate in seconds%%Written by G. Perron February 2nd 1999%Using the Signal Processing Toolbox%$Id: resamp.m,v 2.0 1999/05/21 18:46:19 mah Exp gilles $%$Log: resamp.m,v $%Revision 2.0 1999/05/21 18:46:19 mah%Release 2%%Revision 1.2 1999/05/21 15:06:44 mah%eof problem%%Revision 1.1 1999/02/02 15:31:25 perron%Initial revision%%function call echodisp('[dataout]=resamp(datain,smp_rate)');%getting the old sampling rateold_rate=datain.fh{8};%checking if the ratio of the two sampling rates is an integercheck=mod(smp_rate,old_rate);%if the ratio is an integerif check ==0 %get the ration and setting variables p and q for resample.m q=smp_rate/old_rate; p=1; %initializing the output variable dataout=datain; %looping over records of data for i=1:datain.fh{12} dataout.dat{i}=resample(datain.dat{i},p,q); end %getting the number of samples per trace [a,b]=size(dataout.dat{1}); %setting the number of samples per trace and the new sampling rate dataout.fh{7}=a; dataout.fh{8}=smp_rate;%if the ratio is not an integerelse disp('The ratio of the new and the old sampling rates is NOT an integer');end@2.0log@Release 2@text@d15 1a15 1%$Id: resamp.m,v 1.2 1999/05/21 15:06:44 mah Exp mah $d17 3@1.2log@eof problem@text@d15 1a15 1%$Id: resamp.m,v 1.1 1999/02/02 15:31:25 perron Exp mah $d17 3@1.1log@Initial revision@text@d1 48a48 45function [dataout]=resamp(datain,smp_rate)
%This function resamples a DSI variable dataset
%to a user specified sampling rate. The ratio
%of the new sampling over the old must be an integer
%
%function [dataout]=resamp(datain,smp_rate)
%
%Input variables
%datain - DSI variable dataset to be resampled
%smp_rate - new user specified sampling rate in seconds
%
%Written by G. Perron February 2nd 1999
%Using the Signal Processing Toolbox
%$Id:$
%$Log:$
%function call echo
disp('[dataout]=resamp(datain,smp_rate)');
%getting the old sampling rate
old_rate=datain.fh{8};
%checking if the ratio of the two sampling rates is an integer
check=mod(smp_rate,old_rate);
%if the ratio is an integer
if check ==0
%get the ration and setting variables p and q for resample.m
q=smp_rate/old_rate;
p=1;
%initializing the output variable
dataout=datain;
%looping over records of data
for i=1:datain.fh{12}
dataout.dat{i}=resample(datain.dat{i},p,q);
end
%getting the number of samples per trace
[a,b]=size(dataout.dat{1});
%setting the number of samples per trace and the new sampling rate
dataout.fh{7}=a;
dataout.fh{8}=smp_rate;
%if the ratio is not an integer
else
disp('The ratio of the new and the old sampling rates is NOT an integer');
end
@
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -