合成记录制作示意程序
(2022-11-11 16:28:21)
标签:
上机作业(2) |
分类: 《信号分析与处理》课 |
#include "stdio.h" // standard input/output head file.
#include "math.h" // math. head file.
#include "malloc.h" // memory allocation head file.
#define fm 35 // The main frequency of
Ricker wavelet, you can change it.
#define dt 0.002 // The sample interval, you
can also set it to 0.001 or 0.004.
#define XL 0.060 // The length of
wavelet(s), you can change it.
#define HL 0.300 // The length of h(t),
namely reflection coefficient.
#define PI 3.1415926
main()
{
// allocate dynamic array.
// Generate Ricker wavelet.
// Generate reflection coefficient.
// set initial value to zero.
// Generate different ksai[i].
// You can design different reflection coefficient
sequence.
// Do convolution x(n)*h(n).
// Output the results. Let the length of y(n) be equal to
h(t), cut y(n).
{
}
// The function of convolution.
void conv(float x[],int m,float h[],int n,float y[],int
l)
{ int k,i;
if(k-i>=0&&k-i<=n-1)y[k]=y[k]+x[i]*h[k-i];
}
前一篇:一般卷积实现程序

加载中…