Arrays 在matlab中生成离散时间周期信号

Arrays 在matlab中生成离散时间周期信号,arrays,matlab,signal-processing,periodicity,Arrays,Matlab,Signal Processing,Periodicity,x[t]是一个离散时间周期信号,在一个周期内定义如下 x[t] = {1 , 2 , 1 , 2 , 3 , 1 , 2 , 3 , 4.....} 我想在Matlab中将其生成为间隔[0100]的周期信号。但是,我无法为此编写代码。在matlab中,如果要生成周期信号,有许多方法,其中之一是: %x is array that represent discrete time signal. %y is generated periodic signal %n the number of p

x[t]是一个离散时间周期信号,在一个周期内定义如下

x[t] = {1 , 2 , 1 , 2 , 3 , 1 , 2 , 3 , 4.....}

我想在Matlab中将其生成为间隔[0100]的周期信号。但是,我无法为此编写代码。

在matlab中,如果要生成周期信号,有许多方法,其中之一是:

%x is array that represent discrete time signal.
%y is generated periodic signal 
%n the number of periods

temp=x'*ones(1,n);
y=temp(:);
% where x' is transpose of x.
% if we suppose x=[1,2,3]
% if we want to repeat it five times we can say n = 5
% then temp will equal [ 1 1 1 1 1
%                        2 2 2 2 2
%                        3 3 3 3 3]
%fianlly y will equal [1 2 3 1 2 3 1 2 3 1 2 3 1 2 3]

也许你可以试试下面的
arrayfun

X = arrayfun(@(k) 1:k, 2:4, "UniformOutput",false);
x = repmat([X{:}],1,2);

x =

   1   2   1   2   3   1   2   3   4   1   2   1   2   3   1   2   3   4

我不确定你所说的“周期信号”是什么意思,因为你在那里显示的信号不是周期性的,除非你只显示了一个周期。@AnderBiguri是的,它是一个周期。我已经提到过这一点。@AIASAD WAIL我提到的离散时间信号与此信号不同。
repmat
函数以更易于阅读的方式完成此操作。@CrisLuengo您能写代码或给出提示吗?@SeñoraPenn发送您想要表示它的数学方程。@SeñoraPenn发送您的数学公式你们想要表示它的方程,我不想要这个信号,我想要这个信号重复它自己。您收到的信号“x”超过一个周期。我想得到这样的东西-x={1,2,1,2,3,1,2,3,4,1,2,1,2,3,3,1,2,3,4,…}@SeñoraPenn请看我的更新,例如有两个重复,你可以根据需要有更多。谢谢这很有效。