increment=.01;
position=21;
separation=1.5;
width1=.5; % Width of the original signal peak.
width2=1; % Width of the original signal peak.
width3=2; % Width of the original signal peak.
%
% Create simulated signal
x=10:increment:30;
y1=1/width3.*(lorentzian(x,position-separation,width3)+.5.*lorentzian(x,position+separation,width3));  % Create a function y of width w.
y2=y1.^3;
y3=y1.^6;
% Normailze
y1=y1./max(y1);
y2=y2./max(y2);
y3=y3./max(y3);

figure(1)
clf
plot(x,y1,x,y2,x,y3,'linewidth',2)
title('Power method: Changing peak widths, normalized to 1.00')
grid
xlabel('Narrower peaks results in higher (better) resolution of the peaks, but changes peak ratios')
ylabel('y^p')
legend('p=1','p=3','p=6')

a1=trapz(x,y1);
a2=trapz(x,y2);
a3=trapz(x,y3);

figure(2)
clf
f=1:length(x)/2;
fs1=FrequencySpectrum(x,y1./mean(y1));
fs2=FrequencySpectrum(x,y2./mean(y2));
fs3=FrequencySpectrum(x,y3./mean(y3));

loglog(f,fs1(:,2),f,fs2(:,2),f,fs3(:,2),'linewidth',2)
axis([1 100 1e-0 1e7])
grid
title('Frequency spectra: The narrower the peaks the greater the high-frequency content')
xlabel('Frequency, bin number')
ylabel('Amplitude')

