【问题标题】:Generating discrete time periodic signal in matlab在matlab中生成离散时间周期信号
【发布时间】:2021-05-01 09:42:32
【问题描述】:

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

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

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

【问题讨论】:

  • 我不确定您所说的“周期性信号”是什么意思,因为您在那里显示的信号不是周期性的,除非您只显示了 1 个周期。
  • @AnderBiguri 是的,它是 1 个时期。我已经提到了这一点。

标签: arrays matlab signal-processing periodicity


【解决方案1】:

在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]

【讨论】:

  • @AIASAD WAIL 我提到的离散时间信号和这个不同。
  • repmat 函数以更易于阅读的方式执行此操作。
  • @CrisLuengo 你能写代码或给出提示吗?
  • @SeñoraPenn 发送您想要表示的数学方程式。
  • @SeñoraPenn 发送您想要表示的数学方程式。
【解决方案2】:

也许你可以试试下面的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

【讨论】:

  • 我不只想要这个信号,我想要这个信号重复自己。您收到的信号“x”超过一个周期。我想得到这样的东西- x={1 , 2 , 1 , 2 , 3 , 1 , 2 , 3 , 4, 1 , 2 , 1 , 2 , 3 , 1 , 2 , 3 , 4, ... ...}
  • @SeñoraPenn 查看我的更新,例如有两次重复,您可以根据需要进行更多。
猜你喜欢
  • 1970-01-01
  • 2015-06-14
  • 1970-01-01
  • 2011-10-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-11
相关资源
最近更新 更多