如何生成由零分隔的正弦波形流?

时间:2016-05-31 15:03:38

标签: matlab signal-processing

% initialize pulse width
t0 = 0;
t1 = 10;
t = t0: 0.01: t1;
% initialize number of pulses
nPulse = 4;
x = sin(t);
figure (1);
plot(t, x);
axis tight;
% initialize PRI (pulse repetition interval)
PRI = 20;
delay = zeros(1, PRI);
inputsignal = [x delay];
figure (2);
plot(inputsignal)
for i = 3: 5
    inputsignal(:, i) = inputsignal(:, i - 2);
    if i <= 4
        for i = i + 1
            inputsignal(:, i) = inputsignal(:, i - 2);
        end
    end
end
figure (3)
plot(inputsignal(:, i))

基本上,我想生成一串由零分隔的正弦曲线。具体来说,我想生成四个脉冲;每个脉冲后跟一个零向量。我希望得到一些输入信号= [x延迟x延迟x延迟x延迟]。

PRI参数定义应遵循每个脉冲的零。

1 个答案:

答案 0 :(得分:1)

您希望在绘图之前使用repmat重复一系列xdelay

% Repeat this 4 times
data = repmat([x delay], [1 4]);

% Plot the data
plot(data);

enter image description here