% Compare spectrum of clean and noisy signals

close all;



[Pc f] = pwelch(clean(:,2),[],[],[],fs);

[Pn f] = pwelch(noisy(:,2),[],[],[],fs);



Pc_dB = 10*log10(Pc);

Pn_dB = 10*log10(Pn);



fRange = [min(f) max(f)];

plot(f,Pc_dB,'LineWidth',2); hold on;

plot(f,Pn_dB,'r--','LineWidth',2);

xlim(fRange);



% Display parameters

fSize = 16;

xlabel('Frequency (Hz)','FontSize',fSize);

ylabel('PSD (dB/Hz)','FontSize',fSize);

grid on;

legend('Clean','Noisy','Location','Best');

title('Comparison of clean and noisy power spectra','FontSize',fSize);

set(gca,'FontSize',fSize);