function [fig1]=confplot(uvw,range,radial)



freqs=[0.01:0.01:.4];
dirres=2;



%calculate just the frequency energy spectrum
uvwfreq=sum(uvw.S')*dirres;
rangefreq=sum(range.S')*dirres;
radialfreq=sum(real(radial.S)')*dirres;

%Compute the coefficient for the upper and lower error bounds for the power
%spectrum assuming 95% confidence.  Added on 9/17/08
degF=radial.degF;
chiUp=chi2inv(.975,degF);
chiLow=chi2inv(.025,degF);
coeffUp=degF/chiLow;
coeffLow=degF/chiUp;
logCoeffUp=log10(coeffUp);
logCoeffLow=log10(coeffLow);

%calculate the conf limits throughout the frequency spectrum
radialfreqUP=radialfreq*coeffUp;
radialfreqLOW=radialfreq*coeffLow;

%same thing for the Puvw and range
degF2=25;
chiUp2=chi2inv(.975,degF2);
chiLow2=chi2inv(.025,degF2);
coeffUp2=degF2/chiLow2;
coeffLow2=degF2/chiUp2;
logCoeffUp2=log10(coeffUp2);
logCoeffLow2=log10(coeffLow2);

%calculate the conf limits throughout the frequency spectrum
uvwfreqUP=uvwfreq*coeffUp2;
uvwfreqLOW=uvwfreq*coeffLow2;
rangefreqUP=rangefreq*coeffUp2;
rangefreqLOW=rangefreq*coeffLow2;

scrsz = get(0,'ScreenSize');
fig1=figure('Position',[scrsz]);

%plot the frequency energy spectrum
h1=semilogy(freqs,uvwfreq,'b');
hold on
plot([0.1,0.1],[10^logCoeffLow2,10^logCoeffUp2],'b.-');
%plot(freqs,EMEPfreqUP,'b--');
%plot(freqs,EMEPfreqLOW,'b--');

h2=semilogy(freqs,rangefreq,'r');
plot([0.11,0.11],[10^logCoeffLow2,10^logCoeffUp2],'r.-');
%plot(freqs,EMEPrangefreqUP,'r--');
%plot(freqs,EMEPrangefreqLOW,'r--');

h3=semilogy(freqs,radialfreq,'g');
plot([0.12,0.12],[10^logCoeffLow,10^logCoeffUp],'g.-');
%plot(freqs,EMEPradialfreqUP,'g--');
%plot(freqs,EMEPradialfreqLOW,'g--');
ylim([10^-2,10^1]);
%set(gca,'ytick',[-4 -3 -2 -1 0 1]);
axis(axis);
legend([h1,h2,h3],'EMEP uvw','EMEP range','EMEP radial','location','best');
title('1d Frequency Spectrum');
xlabel('frequency in Hz');
ylabel('m^2 / hz');








