how to apply hamming window to sinal
    23 views (last 30 days)
  
       Show older comments
    
hello, i am new in matlab. i have created the modulated signal but don't know how to apply the hamming window to the signal.
    clc
clear all
close all
%%Details
Ac = 5;                         % carrier amplitude
fc = 10000;                     % carrier frequency
Am = 1;                         % modulating signal amplitude
fm = 1000;                      % modulating signal frequency
Tc = 1 / fc;                    % carrier period
Ts = Tc / 100;                  % sample interval  
Pm = 1 / fm;                    % signal period  
t = 0 : Ts : 5*Pm;              % 5 cycles
Vm = Am*cos(2*pi*fm*t);         % message signal
Vc = Ac*sin(2*pi*fc*t);         % carrier signal
Vam = (Ac+Vm).*sin(2*pi*fc*t);  % amplitude modulated signal
%%Plot three signals
figure(1)
    subplot(311)
    plot(t,Vm);
    title('Message signal');
    xlabel('Time(s)');
    ylabel('Amplitude(V)');
    grid
    subplot(312)
    plot(t,Vc);
    title('Carrier singal');
    xlabel('Time(s)');
    ylabel('Amplitude(V)');
    grid
    subplot(313)
    plot(t,Vam);
    title('Amplitude Modulated Signal');
    xlabel('Time(s)');
    ylabel('Amplitude(V)');
    grid 
%%Plot spectrum of AM signal
L=10^24;                         % number of samples 
k=0:L-1;  
f=k./(L*Ts);                    % frequency in Hz
Xam=(2/L)*abs(fft(Vam,L)); 
figure(2)
    plot(f, Xam)
    title('Spectrum of modulated signal')
    xlabel('Frequency(Hz)')
    ylabel('Magnitude')
    grid on
%%window function
0 Comments
Answers (1)
  dpb
      
      
 on 1 Apr 2014
        ...
Vam = (Ac+Vm).*sin(2*pi*fc*t);  % amplitude modulated signal
VamWindowed=Vam.*hamming(length(t),'periodic');
doc hamming
for (a little) more detail
0 Comments
See Also
Categories
				Find more on Hamming in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
