Changeset 215
- Timestamp:
- 11/02/08 15:12:09
- Files:
-
- DPWavesProc/trunk/DPWavesProc/RELEASENOTES.txt (modified) (1 diff)
- DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialtouvw.m (modified) (1 diff)
- DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialwaveplot.m (modified) (8 diffs)
- DPWavesProc/trunk/DPWavesProc/adcp_matlab/specmultiplot.m (modified) (6 diffs)
- DPWavesProc/trunk/DPWavesProc/adcp_matlab/waveplot.m (modified) (13 diffs)
- DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/dirspec.m (modified) (3 diffs)
- DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/infospec.m (modified) (5 diffs)
- DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/private/Hsig.m (modified) (1 diff)
- DPWavesProc/trunk/DPWavesProc/nortek/nortek_Winfo_plot.m (modified) (1 diff)
- DPWavesProc/trunk/DPWavesProc/nortek/nortek_specmultiplot.m (modified) (5 diffs)
- DPWavesProc/trunk/DPWavesProc/nortek/nortek_waveplot.m (modified) (9 diffs)
- DPWavesProc/trunk/DPWavesProc/radialtouvw1.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
DPWavesProc/trunk/DPWavesProc/RELEASENOTES.txt
r40 r215 1 This is the first BETA release of DPWavesProc. DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialtouvw.m
r168 r215 182 182 %transform the original x,y,z positions to the new positions accounting for 183 183 %heading, pitch and roll... we also add adcpheight back in 184 new xyzpos=ones(3,4,5);184 new_xyzpos=ones(3,4,5); 185 185 new_xyzpos(1,:,:)=xyzpos(1,:,:)*a+xyzpos(2,:,:)*b+xyzpos(3,:,:)*c; 186 186 new_xyzpos(2,:,:)=xyzpos(1,:,:)*d+xyzpos(2,:,:)*e+xyzpos(3,:,:)*f; DPWavesProc/trunk/DPWavesProc/adcp_matlab/radialwaveplot.m
r168 r215 58 58 IMLMfreq=sum(real(radialI.S)')*dirres; 59 59 wmonfreq=sum(wmon.S')*wmondirres; 60 61 %Compute the coefficient for the upper and lower error bounds for the 62 %frequency 63 %spectrum assuming 95% confidence. Added on 9/17/08 64 degF=radialE.degF; 65 chiUp=chi2inv(.975,degF); 66 chiLow=chi2inv(.025,degF); 67 coeffUp=degF/chiLow; 68 coeffLow=degF/chiUp; 69 70 %calculate the conf limits throughout the frequency spectrum 71 EMEPfreqUP=EMEPfreq*coeffUp; 72 EMEPfreqLOW=EMEPfreq*coeffLow; 60 73 61 74 %Find the maximum for the directional spectrum so we can set up the proper … … 115 128 %plot the frequency energy spectrum 116 129 subplot(1,2,2); 117 plot(freqs,EMEPfreq,'b');130 h1 = plot(freqs,EMEPfreq,'b'); 118 131 hold on 119 plot(wmon.freqs,wmonfreq,'k'); 132 h2 = plot(freqs,EMEPfreqLOW,'b--'); 133 h3 = plot(freqs,EMEPfreqUP,'b--'); 134 h4 = plot(wmon.freqs,wmonfreq,'k'); 120 135 axis(axis); 121 plot(freqs,IMLMfreq,'c');122 legend( 'EMEP radial vel','wavesmon','IMLM radial vel','location','best');136 %h5 = plot(freqs,IMLMfreq,'c'); 137 legend([h1,h2,h4],'EMEP radial vel','EMEP radial 95% conf limits', 'wavesmon','location','best'); 123 138 title('directional wave spectrum integrated over direction'); 124 139 xlabel('frequency in Hz'); … … 135 150 % Calculate the Sig wave height 136 151 EMEP_radial_Hsig=4*sqrt(m0); 152 %Use the function HsigConf.m to calculate the sigH confidence limits 153 EMEP_HsConf=HsigConf(radialE); 137 154 138 155 % Calculate the peak period Tp … … 151 168 disp(['EMEP radial vel']); 152 169 disp(['SigH (meters): ' num2str(EMEP_radial_Hsig)]); 170 disp(['SigH 95% confidence limits: ' num2str(EMEP_HsConf)]); 153 171 disp(['peak period (seconds): ' num2str(EMEP_radial_Tp)]); 154 172 disp(['Dir of peak period: ' num2str(compangle(EMEP_radial_DTp, radialE.xaxisdir))]); … … 157 175 158 176 E_radial_WI.hsig=EMEP_radial_Hsig; 177 E_radial_WI.hconf=EMEP_HsConf; 159 178 E_radial_WI.tp=EMEP_radial_Tp; 160 179 E_radial_WI.dtp=compangle(EMEP_radial_DTp, radialE.xaxisdir); … … 169 188 % Calculate the Sig wave height 170 189 IMLM_radial_Hsig=4*sqrt(m0); 190 %Use the function HsigConf.m to calculate the sigH confidence limits 191 IMLM_HsConf=HsigConf(radialI); 171 192 172 193 % Calculate the peak period Tp … … 185 206 disp(['IMLM radial vel']); 186 207 disp(['SigH (meters): ' num2str(IMLM_radial_Hsig)]); 208 disp(['SigH 95% confidence limits: ' num2str(IMLM_HsConf)]); 187 209 disp(['peak period (seconds): ' num2str(IMLM_radial_Tp)]); 188 210 disp(['Dir of peak period: ' num2str(compangle(IMLM_radial_DTp, radialI.xaxisdir))]); … … 191 213 192 214 I_radial_WI.hsig=IMLM_radial_Hsig; 215 I_radial_WI.hconf=IMLM_HsConf; 193 216 I_radial_WI.tp=IMLM_radial_Tp; 194 217 I_radial_WI.dtp=compangle(IMLM_radial_DTp, radialI.xaxisdir); DPWavesProc/trunk/DPWavesProc/adcp_matlab/specmultiplot.m
r168 r215 35 35 Winfo.setup={'EMEP UVW','IMLM UVW','EMEP range','IMLM range','EMEP radial','IMLM radial','wavesmon'}'; 36 36 Winfo.hsig=[]; 37 Winfo.hconf=[]; 37 38 Winfo.peakP=[]; 38 39 Winfo.dirP=[]; … … 66 67 67 68 %run diwasp to generate this spectrum 68 [E_uvw_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});69 [E_uvw_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 69 70 70 71 %now for IMLM 71 72 EP.method='IMLM'; 72 73 EP.iter=3; 73 [I_uvw_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});74 [I_uvw_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 74 75 75 76 %set up data with ranges, freq and dir at default … … 77 78 78 79 % run diwasp to generate this spectrum with EMEP 79 [E_range_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});80 [E_range_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 80 81 81 82 %now with IMLM 82 83 EP.method='IMLM'; 83 84 EP.iter=3; 84 [I_range_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});85 [I_range_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 85 86 86 87 %set up data with radial velocities, freq and dir at default … … 88 89 89 90 % run diwasp to generate this spectrum with EMEP 90 [E_radial_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});91 [E_radial_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 91 92 92 93 %now with IMLM 93 94 EP.method='IMLM'; 94 95 EP.iter=3; 95 [I_radial_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});96 [I_radial_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 96 97 97 98 %Use waveplot to plot the polar, freq and dir plots of the spectra … … 115 116 116 117 hsig=[vertcat(E_UVW_WI.hsig,I_UVW_WI.hsig,E_range_WI.hsig,I_range_WI.hsig,E_radial_WI.hsig,I_radial_WI.hsig,wmon_WI.hsig)]; 118 hconf=[vertcat(E_UVW_WI.hconf,I_UVW_WI.hconf,E_range_WI.hconf,I_range_WI.hconf,E_radial_WI.hconf,I_radial_WI.hconf,[NaN NaN])]; 117 119 peakP=[vertcat(E_UVW_WI.tp,I_UVW_WI.tp,E_range_WI.tp,I_range_WI.tp,E_radial_WI.tp,I_radial_WI.tp,wmon_WI.tp)]; 118 120 dirP=[vertcat(E_UVW_WI.dtp,I_UVW_WI.dtp,E_range_WI.dtp,I_range_WI.dtp,E_radial_WI.dtp,I_radial_WI.dtp,wmon_WI.dtp)]; … … 121 123 122 124 Winfo.hsig=[horzcat(Winfo.hsig,hsig)]; 125 Winfo.hconf=[horzcat(Winfo.hconf,hconf)]; 123 126 Winfo.peakP=[horzcat(Winfo.peakP,peakP)]; 124 127 Winfo.dirP=[horzcat(Winfo.dirP,dirP)]; DPWavesProc/trunk/DPWavesProc/adcp_matlab/waveplot.m
r168 r215 70 70 IMLMrangefreq=sum(real(rangeI.S)')*dirres; 71 71 wmonfreq=sum(wmon.S')*wmondirres; 72 73 %Compute the coefficient for the upper and lower error bounds for the power 74 %spectrum assuming 95% confidence. Added on 9/17/08 75 degF=EMEP.degF; 76 chiUp=chi2inv(.975,degF); 77 chiLow=chi2inv(.025,degF); 78 coeffUp=degF/chiLow; 79 coeffLow=degF/chiUp; 72 80 73 81 %Find the maximum for the directional spectrum so we can set up the proper … … 148 156 149 157 %For EMEP uvw 150 151 %calculate the 0,1,2 moments 152 m0=sum(EMEPfreq*freqres); 153 m1=sum(freqs.*EMEPfreq*freqres); 154 m2=sum((freqs.^2).*EMEPfreq*freqres); 155 % Calculate the Sig wave height 156 EMEP_UVW_Hsig=4*sqrt(m0); 158 % Calculate the Sig wave height 159 EMEP_UVW_Hsig=Hsig(EMEP); 160 %Use the function HsigConf.m to calculate the sigH confidence limits 161 EMEP_HsConf=HsigConf(EMEP); 157 162 158 163 % Calculate the peak period Tp … … 171 176 disp(['EMEP uvw']); 172 177 disp(['SigH (meters): ' num2str(EMEP_UVW_Hsig)]); 178 disp(['SigH 95% confidence limits: ' num2str(EMEP_HsConf)]); 173 179 disp(['peak period (seconds): ' num2str(EMEP_UVW_Tp)]); 174 180 disp(['Dir of peak period: ' num2str(compangle(EMEP_UVW_DTp, EMEP.xaxisdir))]); … … 177 183 178 184 E_UVW_WI.hsig=EMEP_UVW_Hsig; 185 E_UVW_WI.hconf=EMEP_HsConf; 179 186 E_UVW_WI.tp=EMEP_UVW_Tp; 180 187 E_UVW_WI.dtp=compangle(EMEP_UVW_DTp, EMEP.xaxisdir); … … 184 191 % For IMLM uvw 185 192 186 %calculate the 0,1,2 moments 187 m0=sum(IMLMfreq*freqres); 188 m1=sum(freqs.*IMLMfreq*freqres); 189 m2=sum((freqs.^2).*IMLMfreq*freqres); 190 % Calculate the Sig wave height 191 IMLM_UVW_Hsig=4*sqrt(m0); 193 % Calculate the Sig wave height 194 IMLM_UVW_Hsig=Hsig(IMLM); 195 %Use the function HsigConf.m to calculate the sigH confidence limits 196 IMLM_HsConf=HsigConf(IMLM); 192 197 193 198 % Calculate the peak period Tp … … 206 211 disp(['IMLM uvw']); 207 212 disp(['SigH (meters): ' num2str(IMLM_UVW_Hsig)]); 213 disp(['SigH 95% confidence limits: ' num2str(IMLM_HsConf)]); 208 214 disp(['peak period (seconds): ' num2str(IMLM_UVW_Tp)]); 209 215 disp(['Dir of peak period: ' num2str(compangle(IMLM_UVW_DTp, IMLM.xaxisdir))]); … … 212 218 213 219 I_UVW_WI.hsig=IMLM_UVW_Hsig; 220 I_UVW_WI.hconf=IMLM_HsConf; 214 221 I_UVW_WI.tp=IMLM_UVW_Tp; 215 222 I_UVW_WI.dtp=compangle(IMLM_UVW_DTp, IMLM.xaxisdir); … … 218 225 % for Range of EMEP 219 226 220 %calculate the 0,1,2 moments 221 m0=sum(EMEPrangefreq*freqres); 222 m1=sum(freqs.*EMEPrangefreq*freqres); 223 m2=sum((freqs.^2).*EMEPrangefreq*freqres); 224 % Calculate the Sig wave height 225 EMEP_range_Hsig=4*sqrt(m0); 227 % Calculate the Sig wave height 228 EMEP_range_Hsig=Hsig(rangeE); 229 %Use the function HsigConf.m to calculate the sigH confidence limits 230 EMEP_range_HsConf=HsigConf(rangeE); 226 231 227 232 % Calculate the peak period Tp … … 240 245 disp(['EMEP range']); 241 246 disp(['SigH (meters): ' num2str(EMEP_range_Hsig)]); 247 disp(['SigH 95% confidence limits: ' num2str(EMEP_range_HsConf)]); 242 248 disp(['peak period (seconds): ' num2str(EMEP_range_Tp)]); 243 249 disp(['Dir of peak period: ' num2str(compangle(EMEP_range_DTp, rangeE.xaxisdir))]); … … 246 252 247 253 E_range_WI.hsig=EMEP_range_Hsig; 254 E_range_WI.hconf=EMEP_range_HsConf; 248 255 E_range_WI.tp=EMEP_range_Tp; 249 256 E_range_WI.dtp=compangle(EMEP_range_DTp, rangeE.xaxisdir); … … 253 260 %for Range of IMLM 254 261 255 %calculate the 0,1,2 moments 256 m0=sum(IMLMrangefreq*freqres); 257 m1=sum(freqs.*IMLMrangefreq*freqres); 258 m2=sum((freqs.^2).*IMLMrangefreq*freqres); 259 % Calculate the Sig wave height 260 IMLM_range_Hsig=4*sqrt(m0); 262 % Calculate the Sig wave height 263 IMLM_range_Hsig=Hsig(rangeI); 264 %Use the function HsigConf.m to calculate the sigH confidence limits 265 IMLM_range_HsConf=HsigConf(rangeI); 261 266 262 267 % Calculate the peak period Tp … … 275 280 disp(['IMLM range']); 276 281 disp(['SigH (meters): ' num2str(IMLM_range_Hsig)]); 282 disp(['SigH 95% confidence limits: ' num2str(IMLM_range_HsConf)]); 277 283 disp(['peak period (seconds): ' num2str(IMLM_range_Tp)]); 278 284 disp(['Dir of peak period: ' num2str(compangle(IMLM_range_DTp, rangeI.xaxisdir))]); … … 281 287 282 288 I_range_WI.hsig=IMLM_range_Hsig; 289 I_range_WI.hconf=IMLM_range_HsConf; 283 290 I_range_WI.tp=IMLM_range_Tp; 284 291 I_range_WI.dtp=compangle(IMLM_range_DTp, rangeI.xaxisdir); DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/dirspec.m
r168 r215 1 function [SM,EP]=dirspec(ID,SM,EP,varargin) ;1 function [SM,EP]=dirspec(ID,SM,EP,varargin) 2 2 3 3 %DIWASP V1.1 function with GD edit … … 84 84 end 85 85 86 % NOTE: changed from csd to cpsd 6/15/07 87 %calculate the cross-power spectra 86 %NOTE: changed on 9/5/08 window length for cpsd set to be a window equal to 87 %or slightly larger than nfft so padding is limited 88 dataLength=size(ID.data,1); 89 numWindows=ceil(dataLength/nfft); 90 window=ceil(dataLength/numWindows); 91 92 %Do a version check for the upcoming cpsd function. If the version is 2006b 93 %or later (date Aug,3,2006 or datenum 732892 cpsd will be handled 94 %differently. added on 9/17/08 95 [v d]=version; 96 ver_date=datenum(d); 97 98 99 % NOTE: changed cross power spectral function from csd to cpsd 6/15/07 88 100 for m=1:szd 89 101 for n=1:szd 90 [xpstmp,Ftmp]=cpsd(data(:,m),data(:,n),[],[],nfft,ID.fs); 102 % Need to have 2 different cpsd functions depending on Matlab version. 103 % added of 9/17/08 104 if ver_date < 732892 105 [xpstmp,Ftmp]=cpsd(data(:,m),data(:,n),window,[],nfft,ID.fs); 106 else 107 [xpstmp,Ftmp]=cpsd(data(:,n),data(:,m),window,[],nfft,ID.fs); 108 end; 91 109 xps(m,n,:)=xpstmp(2:(nfft/2)+1); 92 110 end 93 111 end 94 112 … … 119 137 end 120 138 139 %What are the number of sensors (data series) used to compute the power 140 %spectrum? If we aren't using radial velocities it is just 1. 141 dataUsed=1; 142 143 144 %NOTE: edited on 8/07 121 145 %have Ss = the spectral average if the radial velocities are used without a 122 146 %pressure or vertical range datatype first 123 147 compare=strcmp('radial',ID.datatypes(1)); 124 125 148 if compare == 1 126 149 Ss=mean(Ss); 127 end 128 150 %since this is using radial velocities the number of data series used 151 %the total number of sensors or szd 152 dataUsed=szd; 153 end 154 155 156 157 %Compute the degrees of freedom depending on cpsd options and the data used 158 %See Emery and Thomson, 2004, added on 9/17/08 159 windowConstant=2.5164; %for Hamming Window (Matlab default for cpsd) 160 degF=dataUsed*2*numWindows*windowConstant; 161 SM.degF=degF; 162 163 129 164 ffs=sum(F<=max(SM.freqs)); 130 165 DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/infospec.m
r168 r215 1 function [H,Tp,DTp,Dp]=infospec(SM) 1 function [H,HsConf,Tp,DTp,Dp]=infospec(SM) 2 3 %Edited on 9/17/08 to include confidence limits for the sig wave height 4 2 5 3 6 %DIWASP V1.1 function … … 8 11 %Outputs: 9 12 %Hsig Signficant wave height (Hmo) 13 %HsConf 95% conf limits for Hsig 10 14 %Tp Peak period 11 15 %DTp Direction of spectral peak … … 14 18 %Inputs: 15 19 %SM A spectral matrix structure containing the file data 20 % 16 21 % 17 22 %Hsig is the significant wave height. Tp is the peak frequency, the highest point in the one dimensional spectrum. … … 25 30 SM=check_data(SM,2);if isempty(SM) return;end; 26 31 27 H=HSig(SM); 32 H=Hsig(SM); 33 HsConf=HsigConf(SM); 28 34 29 35 S=sum(real(SM.S),2); % S is freq spectrum … … 38 44 disp(['Infospec::']); 39 45 disp(['Significant wave height (Hmo): ' num2str(H)]); 46 disp(['Sig wave height 95% confidence limits: ' num2str(HsConf)]); 40 47 disp(['Peak period: ' num2str(Tp)]); 41 48 disp(['Direction of peak period: ' num2str(DTp) ' axis angle / ' num2str(compangle(DTp,SM.xaxisdir)) ' compass bearing']); DPWavesProc/trunk/DPWavesProc/diwasp_1_1GD/private/Hsig.m
r168 r215 1 function Hs=H mo(varargin)1 function Hs=Hsig(varargin) 2 2 %DIWASP V1.1 function to calculate significant wave height 3 3 % DPWavesProc/trunk/DPWavesProc/nortek/nortek_Winfo_plot.m
r168 r215 10 10 h1=plot(Winfo.time,Winfo.hsig(1,:),'b.-'); 11 11 hold on 12 h1a=plot(Winfo.time,Winfo.hconf(1,1:2:end),'b--'); 13 plot(Winfo.time,Winfo.hconf(1,2:2:end),'b--'); 12 14 h2=plot(Winfo.time,Winfo.hsig(2,:),'r.-'); 15 h2a=plot(Winfo.time,Winfo.hconf(2,1:2:end),'r--'); 16 plot(Winfo.time,Winfo.hconf(2,2:2:end),'r--'); 13 17 h3=plot(Winfo.time,Winfo.hsig(3,:),'k.-'); 14 18 15 19 datetick('x',15,'keepticks'); 16 legend([h1, h2, h3],'EMEP','IMLM','nortek','location','best');20 legend([h1,h1a,h2,h2a,h3],'EMEP','EMEP 95% confidence','IMLM','IMLM 95% confidence','nortek','location','best'); 17 21 title(['Significant Wave Height starting on ',datestr(Winfo.time(:,1),0)]); 18 22 xlabel('time'); DPWavesProc/trunk/DPWavesProc/nortek/nortek_specmultiplot.m
r168 r215 11 11 %peak period, direction of peak period and dominant dir. It also generates 12 12 %polar plots and 2d freq and directional plots of a variety of different 13 %estimation methods, resolutions and the wavesmonoutput.13 %estimation methods, resolutions and the nortek quickwave output. 14 14 15 15 … … 38 38 Winfo.setup={'EMEP','IMLM' 'nortek'}'; 39 39 Winfo.hsig=[]; 40 Winfo.hconf=[]; 40 41 Winfo.peakP=[]; 41 42 Winfo.dirP=[]; … … 68 69 69 70 %run diwasp to generate this spectrum 70 [E_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});71 [E_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 71 72 72 73 %now for IMLM 73 74 EP.method='IMLM'; 74 75 EP.iter=3; 75 [I_F01_D2, EPout]=dirspec test(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0});76 [I_F01_D2, EPout]=dirspec(ID,SM,EP,{'PLOTTYPE',0,'MESSAGE',0}); 76 77 77 78 … … 82 83 saveas(fig1,['polar1_' dateinfo '.fig']); 83 84 saveas(fig2,['dirfreq1_' dateinfo '.fig']); 85 86 close all; 84 87 85 86 88 %Fill up the Winfo data structure 87 89 88 90 hsig=[vertcat(E_WI.hsig,I_WI.hsig,nortek_WI.hsig)]; 91 hconf=[vertcat(E_WI.hconf,I_WI.hconf,nortek_WI.hconf)]; 89 92 peakP=[vertcat(E_WI.tp,I_WI.tp,nortek_WI.tp)]; 90 93 dirP=[vertcat(E_WI.dtp,I_WI.dtp,nortek_WI.dtp)]; … … 92 95 93 96 Winfo.hsig=[horzcat(Winfo.hsig,hsig)]; 97 Winfo.hconf=[horzcat(Winfo.hconf,hconf)]; 94 98 Winfo.peakP=[horzcat(Winfo.peakP,peakP)]; 95 99 Winfo.dirP=[horzcat(Winfo.dirP,dirP)]; DPWavesProc/trunk/DPWavesProc/nortek/nortek_waveplot.m
r168 r215 54 54 IMLMfreq=sum(real(IMLM.S)')*dirres; 55 55 nortekfreq=sum(nortek.S')*nortekdirres; 56 57 %Compute the coefficient for the upper and lower error bounds for the 58 %frequency 59 %spectrum assuming 95% confidence. Added on 9/17/08 60 degF=2*EMEP.degF; % 2* since for the Nortek the range beam sampled at 4hz (4096) is decimated or averaged to 2hz (2048) 61 chiUp=chi2inv(.975,degF); 62 chiLow=chi2inv(.025,degF); 63 coeffUp=degF/chiLow; 64 coeffLow=degF/chiUp; 65 66 %calculate the conf limits throughout the frequency spectrum 67 EMEPfreqUP=EMEPfreq*coeffUp; 68 EMEPfreqLOW=EMEPfreq*coeffLow; 69 IMLMfreqUP=IMLMfreq*coeffUp; 70 IMLMfreqLOW=IMLMfreq*coeffLow; 56 71 57 72 %Find the maximum for the directional spectrum so we can set up the proper … … 110 125 %plot the frequency energy spectrum 111 126 subplot(1,2,2); 112 plot(freqs,EMEPfreq,'b');127 h1=plot(freqs,EMEPfreq,'b'); 113 128 hold on 114 plot(freqs,IMLMfreq,'r'); 115 plot(nortekfreqs,nortekfreq,'k'); 116 legend('EMEP','IMLM','nortek quickwave','location','best'); 129 h2=plot(freqs,EMEPfreqUP,'b--'); 130 plot(freqs,EMEPfreqLOW,'b--'); 131 h3=plot(freqs,IMLMfreq,'r'); 132 h4=plot(freqs,IMLMfreqUP,'r--'); 133 plot(freqs,IMLMfreqLOW,'r--'); 134 h5=plot(nortekfreqs,nortekfreq,'k'); 135 legend('EMEP','EMEP 95% confidence','IMLM','IMLM 95% confidence','nortek quickwave','location','best'); 117 136 title('directional wave spectrum integrated over direction'); 118 137 xlabel('frequency in Hz'); … … 129 148 % Calculate the Sig wave height 130 149 EMEP_Hsig=4*sqrt(m0); 150 %Use the function HsigConf.m to calculate the sigH confidence limits 151 EMEP_HsConf=nortek_HsigConf(EMEP); 131 152 132 153 % Calculate the peak period Tp … … 145 166 disp(['EMEP']); 146 167 disp(['SigH (meters): ' num2str(EMEP_Hsig)]); 168 disp(['SigH 95% conf. (meters): ' num2str(EMEP_HsConf)]); 147 169 disp(['peak period (seconds): ' num2str(EMEP_Tp)]); 148 170 disp(['Dir of peak period: ' num2str(compangle(EMEP_DTp, EMEP.xaxisdir))]); … … 151 173 152 174 E_WI.hsig=EMEP_Hsig; 175 E_WI.hconf=EMEP_HsConf; 153 176 E_WI.tp=EMEP_Tp; 154 177 E_WI.dtp=compangle(EMEP_DTp, EMEP.xaxisdir); … … 164 187 % Calculate the Sig wave height 165 188 IMLM_Hsig=4*sqrt(m0); 189 %Use the function HsigConf.m to calculate the sigH confidence limits 190 IMLM_HsConf=nortek_HsigConf(IMLM); 166 191 167 192 % Calculate the peak period Tp … … 180 205 disp(['IMLM']); 181 206 disp(['SigH (meters): ' num2str(IMLM_Hsig)]); 207 disp(['SigH 95% conf. (meters): ' num2str(IMLM_HsConf)]); 182 208 disp(['peak period (seconds): ' num2str(IMLM_Tp)]); 183 209 disp(['Dir of peak period: ' num2str(compangle(IMLM_DTp, IMLM.xaxisdir))]); … … 186 212 187 213 I_WI.hsig=IMLM_Hsig; 214 I_WI.hconf=IMLM_HsConf; 188 215 I_WI.tp=IMLM_Tp; 189 216 I_WI.dtp=compangle(IMLM_DTp, IMLM.xaxisdir); … … 222 249 223 250 nortek_WI.hsig=nortek_Hsig; 251 nortek_WI.hconf=[NaN NaN]; 224 252 nortek_WI.tp=nortek_Tp; 225 253 nortek_WI.dtp=compangle(nortek_DTp, nortek.xaxisdir); DPWavesProc/trunk/DPWavesProc/radialtouvw1.m
r168 r215 1 function [ID,SM,EP,orbitnew]=radialtouvw (pressure,range,orbit,sysinfo,data_type)1 function [ID,SM,EP,orbitnew]=radialtouvw1(pressure,range,orbit,sysinfo,data_type) 2 2 3 3