信号移位时间 [英] Shifting time of a signal

查看:132
本文介绍了信号移位时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑信号x = t.*(2*t + 4)

如果我想对信号进行时移-比如说2个时间值向右-可以做类似的事情

In case I want to time shift the signal -let's say 2 time-values to the right- is it possible to do something like

x = x(t-2)

为了移动所有值? 我偶然发现了circshift,但没有发现我的情况有用

In order to shift all the values ? I stumbled across circshift but I didn't find any use for my case

编辑:我正在寻找一种适用于每种信号的解决方案,例如,如果我反射x(或对其进行任何处理)并将其存储在Y上,我该如何解决?时移Y?

I'm searching for a solution where it will work for every signal, as an example if I reflect x (or do anything on it) and store it on Y, how should I time shift Y?

推荐答案

您可以将信号定义为函数,以便随心所欲地对其进行移位.

You can define the signal as a function, so that you can then shift it as you wish.

例如,

x = @(t) t.*(2*t + 4); % A function x(t)
y = @(t) x(-t); % A reflected version of the function
z = @(t,a) x(t-a); % A delayed version of the function 

t = -5:0.01:5; % Sampling instants

X = x(t); % A vector of samples of the original signal
Y = x(t-2); % A vector of samples of the delayed signal

请注意,如果要定义可以反映和移动任何功能的运算符,则可以例如写

Note that if you want to define operators that can reflect and shift any function, you can e.g. write

Rop = @(s,t) s(-t);
Sop = @(s,a,t) s(t-a);

您可以在x信号上将它们用作

And you can use them on the x signal as

Rop(x,[-2 -1 0 1 2]) % Calculates x([2 1 0 -1 -2])
Sop(x,5,[1 2 3 4 5]) % Calculates x([-4 -3 -2 -1 0])

如果您想将平移和反射结合起来,可以这样做:

If you want to combine shifting and reflection, you can do like this:

Rop(@(t) Sop(x,2,t),[1 2 3 4 5]) % First shifts x by 2, then reflects
Sop(@(t) Rop(x,t),2,[1 2 3 4 5]) % First reflects x, and then shifts by 2

如果运行上面的代码,您将看到反射和移位不是可交换的,因为生成的向量是不同的.

If you run the above code you will see that reflection and shift are not commutative because the resulting vectors are different.

这篇关于信号移位时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆