Matlab 为什么样条曲线和三次曲线的输出和绘图相同?

Matlab 为什么样条曲线和三次曲线的输出和绘图相同?,matlab,signal-processing,Matlab,Signal Processing,数字系统的输入通常是模拟的,但在以数字形式处理信号后,它们以模拟形式返回输出 我试图用插值技术在matlab中编写一个信号重建代码,但我得到的两种插值类型的输出/曲线图与最后一个代码曲线图相同 我的代码如下: t= 0:0.001:1; fm= 10 fs= 8*48 x= sin(2*pi*fm*t) % Message Signal % Plotting discrete time sampled signal x[n] % Pulse Traain d= 0:1/50:1;

数字系统的输入通常是模拟的,但在以数字形式处理信号后,它们以模拟形式返回输出

我试图用插值技术在matlab中编写一个信号重建代码,但我得到的两种插值类型的输出/曲线图与最后一个代码曲线图相同

我的代码如下:

t= 0:0.001:1;

fm= 10
fs= 8*48

x= sin(2*pi*fm*t)     % Message Signal

% Plotting discrete time sampled signal x[n]
% Pulse Traain
d= 0:1/50:1;
y= pulstran(t,d,'rectpuls',0.001)

% Sampling
z= x.*y
%  Non-uniformly quantize the discrete time signal using u-law companding
%    method, u= 100 and number of bits= 8.
% Quantization
N= 8
V= max(x)
u= 100

compsig= compand(x,u,V,'mu/compressor');
L= 2.^N
D= [max(compsig)-min(compsig)]./(L-1);
quants= quant(compsig,D);
xq= compand(quants,u,max(quants),'mu/expander')

% Encode the Signal into discrete levels.
H_e= dsp.UniformEncoder(max(xq),N);
encoder= step(H_e,xq)

%  Decoding the signal from discrete level and reconstruct using spline and cubic 
%    interpolation to reconstruct the analog signal x'(t) from the
%    discrete time signal using $t= 0.001.
H_d= dsp.UniformDecoder(max(xq),N);
decoder= step(H_d,encoder)

% Cubic Interpolation
time= 0:0.0001:1;
ci= interp1(t,decoder,time,'cubic')

% Spline interpolation
time=0:0.0001:1
si= interp1(t,decoder,time,'spline')

figure(01)
subplot(2,1,1)
plot(t,x,'R','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('x')
title('Message Signal')

subplot(2,1,2)
plot(t,y,'B','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('y')
title('Pulse Train')

figure(02)
subplot(2,1,1)
plot(t,z,'C','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('z')
title('Sampled Signal')

subplot(2,1,2)
plot(t,xq,'G','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('xq')
title('Quantized Signal')

figure(03)
subplot(2,1,1)
plot(t,encoder,'M','LineWidth',2)
xlabel('Time')
ylabel('Amplitude')
legend('encoder')
title('Encoded Signal')

subplot(2,1,2)
plot(t,decoder,'K','LineWidth',2)
ylim([-1 1])
xlabel('Time')
ylabel('Amplitude')
legend('decoder')
title('Decoded Signal')

figure(04)
subplot(2,1,1)
plot(time,ci,'B','LineWidth',2)
ylim([-1 1])
xlabel('Time')
ylabel('Amplitude')
legend('ci')
title('Cubic Interpolation')

subplot(2,1,2)
plot(time,ci,'R',time,si,'G')
xlabel('Time')
ylabel('Amplitude')
legend('si')
title('Spline & cubic Interpolation')

我怎样才能看到这两种插值类型的输出/曲线图之间的差异?

只有一个正确的重建结果,两种插值方法都试图近似这一结果

你的输入是这样的,他们都做得很好,所以你看不出有什么不同

您需要一些接近Fs/2的信号内容才能看到任何差异,即使如此,用肉眼也很难看到哪个更好

这两种内插器工作的原因是它们的功能类似于截止频率在Fs/2左右的低通滤波器。它们在远低于该频率的情况下都有良好的响应,而在该频率附近则没有那么好的响应

通过首先使用良好的数字低通滤波器进行插值,将采样频率乘以8左右,然后使用三次插值获得这些新采样之间任何点的任何值,可以更好地重建内容接近Fs/2的信号。您甚至可以调整数字低通,以纠正立方插值最终将导致的小误差,从而产生非常精确的结果