CREATESPEC Spectrum structure constructor CALL: S=createspec(stype,freqtype) stype = 'freq' Frequency spectrum (default) 'dir' Directional spectrum 'k1D' Wave number spectrum 1D 'k2D' Wave number spectrum 2D 'encdir' Encounter directional spectrum 'enc' Encounter frequency spectrum freqtype = 'w' angular frequency (rad/sec) (default) 'f' frequency (Hz) Example: Create a structure with proper fieldnames for directional spectrum S=createspec('dir') See also createcov, datastructures
String representation of date. | |
Convert string to lowercase. | |
Current date and time as date number. | |
Compare strings. | |
Create or convert to structure array. |
Computes spectral density given the auto covariance function | |
Estimates the directional wave spectrum from timeseries | |
Estimate one-sided spectral density from data. | |
Estimate one-sided spectral density, version 2. | |
Iterated maximum likelihood method for estimating the directional distribution | |
Script to computer exercises 3 | |
Calculates (and plots) a JONSWAP spectral density | |
Calculates (and plots) a McCormick spectral density. | |
Make a directional spectrum | |
maximum likelihood method for estimating the directional distribution | |
Calculates (and plots) a Ochi-Hubble spectral density. | |
Spectral density for a harmonic oscillator | |
Calculates (and plots) a Pierson-Moskowitz spectral density. | |
Spectral density (frequency) for a road | |
Calculates a double peaked (swell + wind) spectrum | |
Toggle Transform between angular frequency and frequency spectrum | |
Calculates (and plots) a Wallop spectral density. |
001 function S=createspec(stype,freqtype) 002 % CREATESPEC Spectrum structure constructor 003 % 004 % CALL: S=createspec(stype,freqtype) 005 % 006 % stype = 'freq' Frequency spectrum (default) 007 % 'dir' Directional spectrum 008 % 'k1D' Wave number spectrum 1D 009 % 'k2D' Wave number spectrum 2D 010 % 'encdir' Encounter directional spectrum 011 % 'enc' Encounter frequency spectrum 012 % 013 % freqtype = 'w' angular frequency (rad/sec) (default) 014 % 'f' frequency (Hz) 015 % 016 % Example: Create a structure with proper fieldnames for directional spectrum 017 % S=createspec('dir') 018 % 019 % See also createcov, datastructures 020 021 % Tested on: Matlab 5.3 022 % History: 023 % revised by IR 03.04.2001 - added S.phi=0. 024 % revised by jr 10.07.2000 - Line 47 and 49: semicolon added 025 % revised by es 25.05.2000 - help-text changes 026 % revised by jr 14.01.2000 - Field added: norm: 0 027 % revised by es 19.09.1999 028 % by pab 12.08.99 029 030 if nargin<1|isempty(stype) 031 stype='freq'; 032 else 033 stype=lower(stype); 034 end 035 036 if nargin<2|isempty(freqtype) 037 freqtype='w'; 038 else 039 freqtype=lower(freqtype); 040 end 041 042 n=length(stype); 043 S=struct('S',[]); 044 if strcmp(stype(1),'k') % wavenumber spectrum 045 S.k=[]; 046 if strcmp(stype(n-1),'2') 047 S.k2=[]; 048 end 049 else % 050 if strcmp(freqtype,'f') 051 S.f=[]; 052 else 053 S.w=[]; 054 end 055 if strcmp(stype(n-2:n),'dir') 056 S.theta=[]; 057 end 058 end 059 060 S.tr=[]; 061 062 if strcmp(stype(1:3),'enc') 063 S.v=0; 064 S.phi=0; 065 elseif strcmp(stype(1:3),'rot') 066 S.phi=0; 067 end 068 S.h=inf; 069 S.type=stype; 070 S.phi=0.; 071 S.norm=0; 072 S.note=[]; 073 S.date=datestr(now); 074
Comments or corrections to the WAFO group