plot - How do i mathematically apply a window function to a signal in matlab? -


i trying make plot of windowed signal. plot been made in latex, can't seem recreate plot generated in matlab in latex.

   %% time specifications:    fs = 8000;                   % samples per second    dt = 1/fs;                   % seconds per sample    stoptime = 60;             % seconds    t = (0:dt:stoptime-dt)';     % seconds    %% sine wave:    fc = 60;                     % hertz    x = sin(0.9*pi*t) + sin(0.42*pi*t);    %x = cos(2*pi*fc*t) + cos(2*pi*fc*5*t)+ sin(2*pi*fc*10*t);    % plot signal versus time:    figure;    %plot(t,x);    %xlabel('time (in seconds)');    %title('signal versus time');    %zoom xon;    %%    window = hamming(length(t),'periodic');    %plot(window)    windowed = x.*window;     plot(windowed) 

this generates plot this

enter image description here

but when tries recreate plot in matlab.. way different.

what plotting :

w= sin(0.9*pi*t) + sin(0.42*pi*t)*0.54 - 0.46*( cos(360*t/600)) plot(w) 

first part being signal * window = windowed signal... , this..

enter image description here

why different.. doing wrong?

as see have 2 errors in expression. first miss parenthesis around window function , second have wrong period in cos term. try

 w = (sin(0.9*pi*t) + sin(0.42*pi*t)).*(0.54 - 0.46*( cos(2*pi*t/t(end)))); 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -