我不明白为什么我的代码在3秒钟的时间内没有正确回答,有人可以帮我看看犯罪的平顶采样(pam)模型吗?
fc = 10; %carrier frequency
fm = 1; % message frequency
fs = 1000; % sampling frequency
t = 3;
n = [0:1/fs:t];
n = n(1:end - 1);
duty = 20;
s = square(2*pi*fc*n,duty);
s(find(s<0)) = 0;
m = sin(2*pi*fm*n);
period_samp = length(n)/fc;
ind = [1:period_samp:length(n)];
on_samp = ceil(period_samp * duty/100);
pam = zeros(1,length(n));
for i = 1 : length(ind)
pam(ind(i):ind(i) + on_samp) = m(ind(i));
end