【问题标题】:Using MATLAB to perform upsampling of signal使用 MATLAB 对信号进行上采样
【发布时间】:2015-08-23 16:03:23
【问题描述】:

我正在搜索将信号上采样 3 的代码,我找到了以下步骤

dataSize = size(datain,2);
upsamp = [datain.' zeros(dataSize,1) zeros(dataSize,1)];
len = size(upsamp,1) * size(upsamp,2);
upsamp = reshape(upsamp.',1,len);

我不确定这些步骤应该如何执行?我只是在寻找直觉

【问题讨论】:

  • 如果是因数,直接使用upsample,如果不考虑使用resample。

标签: matlab signal-processing


【解决方案1】:

从Wikipedia复制:

整数因子 L 的插值可以解释为一个两步过程,具有更有效的等效实现:

  1. 创建一个序列 x_L[n],其中包含由 L-1 个零分隔的原始样本 x[n]。
  2. 使用替换零点的低通滤波器消除不连续性。

您还可以阅读更多详细信息here 和here。

函数upsample 只执行第一步,而函数resample 执行这两个步骤。看看下面的代码,注意两张图的不同:

close all; clear all; clc;

t = [0:0.03:1];
x = sin(4*pi*t);

% function resample performs interpolation
y = resample(x, 3, 1);
ty = [0:0.01:1.01];

figure;stem(ty, y, 'r*');
hold on;stem(t, x);

% function upsample adds zeros
z = upsample(x,3);
tz = [0:0.01:1.01];

figure;stem(tz, z, 'r*');
hold on;stem(t, x);

【讨论】:

  • 不错的答案!为什么不包括两个数字,每个数字都在其代码下方?我认为这样答案会更清楚
  • 感谢您的建议,@Luis!我希望现在更清楚了。
猜你喜欢
  • 2021-11-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-27
相关资源
最近更新 更多