资源简介
地震处理软件
SAC格式数据
国际通用地震格式
代码片段和文件信息
#include
#include
#include
#include
#include
#define MAX 4000
#define ERROR_MAX 256
int
main(int argc char *argv[]) {
/* Local variables */
int i j;
long int nlen nlen1 nlen2 nerr max;
float beg delta end;
char *kname;
float yarray1[MAX] yarray2[MAX] ytmp[MAX] xarray[1];
float *out;
long int nwin wlen nfft leven;
char error[ERROR_MAX];
max = MAX;
for(i = 0; i < MAX; i++) {
yarray1[i] = 0.0;
yarray2[i] = 0.0;
ytmp[i] = 0.0;
}
/* Read in the first file */
kname = strdup(“convolvec_in1.sac“);
rsac1(kname ytmp &nlen1 &beg &delta &max &nerr SAC_STRING_LENGTH);
if (nerr != 0) {
fprintf(stderr “Error reading in file(%ld): %s\n“ nerr kname);
exit(-1);
}
/* Read in the second file */
kname = strdup(“convolvec_in2.sac“);
rsac1(kname yarray2 &nlen2 &beg &delta &max &nerr SAC_STRING_LENGTH);
if (nerr != 0) {
fprintf(stderr “Error reading in file: %s\n“ kname);
exit(-1);
}
/* Reverse the First Signal */
j = 0;
for(i = nlen1 - 1; i >= 0; i--) {
yarray1[j] = ytmp[i];
j++;
}
nlen = nlen1;
if(nlen2 > nlen) {
nlen = nlen2;
}
/* Allocate space for the correlation of yarray1 and yarray2 */
max = next2((2 * nlen) - 1) * 2;
out = (float *) malloc(sizeof(float) * max);
if(out == NULL) {
fprintf(stderr “Error allocating memory for correlation\n“);
exit(-1);
}
/* Set up values for the cross correlation */
nwin = 1;
wlen = nlen;
nfft = 0;
/* Call crscor ( Cross Correlation no wait uh Convolution )
* - yarray1 - First Input array to correlate
* - yarray2 - Second Input array to correlate
* - nlen - Number of points in yarray and yarray2
* - nwin - Windows to use in the correlation
* - wlen - Length of the windows
* - type - Type of Window (SAC_RECTANGLE)
* - out - output sequence
* - nfft - Length of the output sequence
* - error - Error Message
* - err_len - Length of Error Message (on input)
*/
crscor(yarray1 yarray2 nlen
nwin wlen SAC_RECTANGLE
out &nfft error ERROR_MAX);
/* Zero out the tmp signal */
for(i = 0; i < MAX; i++) {
ytmp[i] = 0.0;
}
/* Reconstruct the signal from the “cross correlation“ back to front
*
* ytmp[0 : nlen1 - 2 ] <- out[nfft-nlen1+1 : nfft - 1 ]
* ytmp[nlen1 - 1 : nlen1 + nlen2 -2 ] <- out[0 : nlen2 - 1 ]
*
* nfft-1 is the last point of the output sequence
*/
for(i = 0; i <= nlen1 - 2; i++) {
ytmp[i] = out[nfft - nlen1 + i + 1];
}
for(i = 0; i <= nlen2 - 1; i++) {
ytmp[nlen1 + i - 1] = out[i
相关资源
- arm cortex m0 rtl code
- Xcode 12.3(16F156)安装包.zip
- Convex Analysis and Optimization (Bertsekas
- Antenna Theory Analysis and Design.3rd Edition
- windows 64位系统下安装Code Warrior6.3方法
- Zxing-Code_128一维码
- CODE128A 字体
- Code 128 字体
- INBarcodeOCR条码识别组件,识别率及速
- code39条形码字体
- 飞思卡尔68HC08Metrowerks_CodeWarrior开发软
- codewarrior使用指南中文版
- Code Warrior License 破解,各个版本可用
- Codewarrior HCS12 V5.1 license
- codewarrior6.3 win10环境可以安装的破解
- Codesys变成入门手册
- Modeling rockfall process using numerical mani
- patchedcode.bin
- 奥科网关M1000B配置手册.docx
- icm20948_Sensor_Code.zip
- Using GIS to Perform Seismic Hazard Analysis
- Bioinformatics analysis of tyrosinase-related
- Mechanism Analysis for Catalytic Synthesis of
- OzCode3.X Patch 注册机
- CWAP Certified Wireless Analysis Professional
- 最新原版PDF:Antenna Theory - Analysis an
- Qt实现Code39条形码
- shellcoder编程揭秘
- 数值分析导论 第三版
- 黄金矿工源码
评论
共有 条评论