Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 其它 > 资料存档
资料存档 资料存档
回复
 
主题工具 显示模式
旧 2019-12-10, 20:30   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 如何在Matlab中使用circshift?我究竟做错了什么?

我想在Matlab中绘制“油腻的”测试信号,然后在同一图中绘制高斯函数。下面的脚本可以做到这一点。

但是我希望能够将Gauss函数放置在某个位置,因此我看到其他人经常使用CIRCSHIFT来移动绘图。

使用它时,我可以将高斯功能向左或向右移动,但不能上下移动。

脚本中使用的PGAUSS来自LTFAT DSP第三方工具箱,但是它可以用于调试任何功能。例如-x ^ 2。

有人可以找出我在做什么错吗?

这是[0 0] 替代文字的样子http://img268.imageshack.us/img268/1130/66837635.png

[0 111] 替代文字的外观如下: http://img684.imageshack.us/img684/2386/0111q.png

这是[111 0] 替代文字的外观http://img194.imageshack.us/img194/8760/1110d.png

很多爱,路易丝

g = greasy; fs = 16000; Lg = length(g); % -2441 so just get the first 500 points L2 = floor(Lg/2)+1 - 2441; gf = greasy; gf = gf(1:L2); hold on plot (1:L2,gf); xlabel('Time / samples'); ylabel('Amplitude'); % Contructing values to make the plot look as desired L = 500; tfr = 1; cent = 300; %gw = pgauss(L,tfr,cent) % Here I would have expected the Gauss function to be % moved down, but nothing happens. gw = circshift(pgauss(L,tfr,cent), [0 -1]); plot(gw,'Color','red'); % Multiply the signal with the Gauss window figure(2); plot(gf.*gw);

回答:

您想要做的是向高斯函数添加一个常数因子以向上或向下移动它。
B = [1,2,3,4,5]

B =

1 2 3 4 5
尺寸(B)

回答=

1 5
circshift(B,[2 0])

它什么也不做,因为B只有一行,所以无论rowshift的值如何,该行都会返回到其原始位置

回答=

1 2 3 4 5
circshift(B,[0 2])

回答=

4 5 1 2 3
B + 5

回答=

6 7 8 9 10



更多&回答...
poster 当前离线   回复时引用此帖
回复


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛禁用 表情符号
论坛启用 [IMG] 代码
论坛启用 HTML 代码



所有时间均为北京时间。现在的时间是 05:13


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.