![]() |
如何在Matlab中使用circshift?我究竟做错了什么?
我想在Matlab中绘制“油腻的”测试信号,然后在同一图中绘制高斯函数。下面的脚本可以做到这一点。
但是我希望能够将Gauss函数放置在某个位置,因此我看到其他人经常使用CIRCSHIFT来移动绘图。 使用它时,我可以将高斯功能向左或向右移动,但不能上下移动。 脚本中使用的PGAUSS来自LTFAT DSP第三方工具箱,但是它可以用于调试任何功能。例如-x ^ 2。 有人可以找出我在做什么错吗? 这是[0 0] [URL="http://img268.imageshack.us/img268/1130/66837635.png"]替代文字的[/URL]样子[URL]http://img268.imageshack.us/img268/1130/66837635.png[/URL] [0 111] [URL="http://img684.imageshack.us/img684/2386/0111q.png"]替代文字的[/URL]外观如下: [URL="http://img684.imageshack.us/img684/2386/0111q.png"]http://img684.imageshack.us/img684/2386/0111q.png[/URL] 这是[111 0] [URL="http://img194.imageshack.us/img194/8760/1110d.png"]替代文字的[/URL]外观[URL]http://img194.imageshack.us/img194/8760/1110d.png[/URL] 很多爱,路易丝 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]回答:[/B] 您想要做的是向高斯函数添加一个常数因子以向上或向下移动它。 [INDENT] B = [1,2,3,4,5] [/INDENT]B = 1 2 3 4 5 [INDENT]尺寸(B) [/INDENT]回答= 1 5 [INDENT] circshift(B,[2 0]) [/INDENT]它什么也不做,因为B只有一行,所以无论rowshift的值如何,该行都会返回到其原始位置 回答= 1 2 3 4 5 [INDENT] circshift(B,[0 2]) [/INDENT]回答= 4 5 1 2 3 [INDENT] B + 5 [/INDENT]回答= 6 7 8 9 10 [url=https://stackoverflow.com/questions/1994984]更多&回答...[/url] |
所有时间均为北京时间。现在的时间是 04:53。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.