using TyPlot
using TyMath
wm = 1;
wc = 1.1wm;
Ts = 0.7pi/wm;
ws = 2pi/Ts;
n = -100:100;
nTs = nTs;
f = sinc.(nTs/pi);
Dt = 0.005;
t = -15:Dt:15;
t_vector = collect(t);
nTs_matrix = repeat(nTs, 1, length(t_vector));
t_matrix = repeat(t_vector', length(nTs), 1);
fa = f .* Ts * wc/pi .* sinc.((wc/pi) .* (t_matrix .- nTs_matrix));
sinc_t = sinc.(t / pi);
sinc_t_matrix = repeat(sinc_t', length(nTs), 1);
error = abs.(fa .- sinc_t_matrix);
t1=-15:0.5:15;
f1=sinc(t1/pi);
subplot(311);
stem(t1,f1);
xlabel("kTs");
ylabel("f(kTs)");
title("sa(t)=sinc(t/pi)的采样信号");
subplot(312);
plot(t,fa)
xlabel("t");
ylabel("fa(t)");
title("由sa(t)=sinc(t/pi)的采样信号重构sa(t)");
subplot(313);
plot(t,error);
xlabel("t");
ylabel("error(t)");
tightlayout()
我的问题是该代码得出的结果图
与书上的
不一样,不知道问题出在哪里?求解答