function plot_power_spectrum(ps,points,new,col); %function plot_power_spectrum(ps,points,new,col); %ps: power spectrum to be plotted %points: number of pulse samples in [0,T) %new: 1=build a new figure, 0 plot on existing one %col: color (a character) warning off f=0:points/(length(ps)+1):points/4; if new h0=figure; length(ps) f=0:points/(length(ps)+1):points/4; h1 = axes('Parent',h0, ... 'YLimMode','manual', ... 'YLim',[-80, 0], ... 'XLimMode','manual', ... 'XLim',[0, f(length(f))]); hold; else hold; end fi=1:length(f); plot(f,10*log10(ps(fi)/max(ps)),col) xlabel('fT'); ylabel('power spectrum [dB]'); warning on hold;