Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use circshift in Matlab? What am I doing wrong?
    primarykey
    data
    text
    <p>I would like to plot the "greasy" test signal in Matlab, and then plot a Gauss function in the same plot. The script below does that.</p> <p>But I would like to be able to place the Gauss function at a certain position, so I see that others often use CIRCSHIFT to move plots.</p> <p>When I use it I can move the Gauss function to the left or right, but not up and down.</p> <p>PGAUSS used in the script comes from the LTFAT DSP third party toolbox, but it could for debugging be any function. E.g. -x^2.</p> <p>Can someone figure out, what I am doing wrong?</p> <p>Here is how it looks with [0 0] <a href="http://img268.imageshack.us/img268/1130/66837635.png" rel="nofollow noreferrer">alt text http://img268.imageshack.us/img268/1130/66837635.png</a></p> <p>Here is how it looks with [0 111] <a href="http://img684.imageshack.us/img684/2386/0111q.png" rel="nofollow noreferrer">alt text http://img684.imageshack.us/img684/2386/0111q.png</a></p> <p>Here is how it looks with [111 0] <a href="http://img194.imageshack.us/img194/8760/1110d.png" rel="nofollow noreferrer">alt text http://img194.imageshack.us/img194/8760/1110d.png</a></p> <p>Lots of love, Louise</p> <pre><code>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); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload