为什么从matlab获得的卷积与理论上获得的不同?
Why convolution obtained from matlab differs from what is obtained theoretically?
指数函数与正弦函数卷积的理论结果如下所示。
当我直接使用 matlab 绘制函数时,我得到了这个,
但是 Matlab conv 命令产生了这个,
这两个地块看起来很相似但并不相同,请看比例尺。 matlab产率是理论结果的十倍。为什么?
matlab代码在这里
clc;
clear all;
close all;
t = 0:0.1:50;
x1 = exp(-t);
x2 = sin(t);
x = conv(x1,x2);
x_theory = 0.5.*(exp(-t) + sin(t) - cos(t));
figure(1)
subplot(313), plot(t, x(1:length(t))); subplot(311), plot(t, x1(1:length(t))); subplot(312), plot(t, x2(1:length(t)))
figure(2)
subplot(313), plot(t, x_theory); subplot(311), plot(t, x1(1:length(t))); subplot(312), plot(t, x2(1:length(t)))
conv
做discrete-time卷积,不做数学积分函数。在数值上,这基本上意味着将两个信号的结果多次相乘和相加,每个点一次,其中一个信号有一个小的偏移。
如果你仔细想想,你就会意识到信号的采样会产生影响。即,如果每 0.1 个值或 0.001 个值有一个点,则乘以的点数不同,因此结果的值不同(形状不同)。
因此,每次做数值卷积时,总是需要乘以采样率,来“归一化”运算。
只需更改您的代码即可
sampling_rate= 0.1;
t = 0:sampling_rate:50;
x = conv(x1,x2)*sampling_rate;
指数函数与正弦函数卷积的理论结果如下所示。
当我直接使用 matlab 绘制函数时,我得到了这个,
但是 Matlab conv 命令产生了这个,
这两个地块看起来很相似但并不相同,请看比例尺。 matlab产率是理论结果的十倍。为什么?
matlab代码在这里
clc;
clear all;
close all;
t = 0:0.1:50;
x1 = exp(-t);
x2 = sin(t);
x = conv(x1,x2);
x_theory = 0.5.*(exp(-t) + sin(t) - cos(t));
figure(1)
subplot(313), plot(t, x(1:length(t))); subplot(311), plot(t, x1(1:length(t))); subplot(312), plot(t, x2(1:length(t)))
figure(2)
subplot(313), plot(t, x_theory); subplot(311), plot(t, x1(1:length(t))); subplot(312), plot(t, x2(1:length(t)))
conv
做discrete-time卷积,不做数学积分函数。在数值上,这基本上意味着将两个信号的结果多次相乘和相加,每个点一次,其中一个信号有一个小的偏移。
如果你仔细想想,你就会意识到信号的采样会产生影响。即,如果每 0.1 个值或 0.001 个值有一个点,则乘以的点数不同,因此结果的值不同(形状不同)。
因此,每次做数值卷积时,总是需要乘以采样率,来“归一化”运算。
只需更改您的代码即可
sampling_rate= 0.1;
t = 0:sampling_rate:50;
x = conv(x1,x2)*sampling_rate;