DEMOSPEC Loads a precreated spectrum of chosen type CALL: S=demospec(stype) S = spectrum struct stype = string 'freq' or 'dir' (default 'freq') Spectra of types 'freq' and 'dir' are available and can be used as test or demo examples. Any other type is possible to get using SPEC2SPEC See also createspec, datastructures, spec2spec
Calculates (and plots) a JONSWAP spectral density | |
Make a directional spectrum | |
Directional spreading functions | |
Linearly spaced vector. | |
Convert string to lowercase. | |
Compare strings. |
Make a directional spectrum |
001 function S=demospec(stype) 002 % DEMOSPEC Loads a precreated spectrum of chosen type 003 % 004 % CALL: S=demospec(stype) 005 % 006 % S = spectrum struct 007 % stype = string 'freq' or 'dir' (default 'freq') 008 % 009 % Spectra of types 'freq' and 'dir' are available 010 % and can be used as test or demo examples. 011 % Any other type is possible to get using SPEC2SPEC 012 % 013 % See also createspec, datastructures, spec2spec 014 015 % Tested on: Matlab 5.3 016 % History: 017 % revised by es 05.06.00 changed call to SPREADING since spreading changed 018 % by es 21.12.1999 m-file calls instead of mat-files 019 % by es 23.09.1999 020 021 if nargin<1|isempty(stype) 022 stype='freq'; 023 end 024 025 if strcmp(lower(stype),'freq') 026 S=jonswap(linspace(0,1.14,257)); 027 else 028 S=jonswap(linspace(0,1.14,257)); 029 D=spreading(linspace(-pi,pi,101),'cos2s',0,15,S.w,0); 030 S=mkdspec(S,D); 031 end 032 S.note=['Demospec: ',S.note,', truncated at 2*wp']; 033 034
Comments or corrections to the WAFO group