Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
高级会员
注册日期: 2019-11-21
帖子: 3,006
声望力: 66 ![]() |
![]()
我想在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 更多&回答... |
![]() |
![]() |