specwelch

Software ID: 129197
specwelch Description

specwelch is a small yet useful script for everyone. It can calculate the spectrum for x using Welchs method. The confidence intervals are calculated using the inverse of chi-square CDF. Also includes a filtering option using the butterworth filter to see the effect of the filter on the spectrum. Usage: q = specwelch(x,dt,w,Nsg,pnv,Wn,ftype,n)[psdf,f] = specwelch(x,dt,w,Nsg,pnv,Wn,ftype,n)[psdf,conf,f] = specwelch(x,dt,w,Nsg,pnv,Wn,ftype,n) Input Var: x - Time series, [vector]dt - Sampling Rate, [scalar]win - Window, one of: hanning, hamming, boxcarNsg - Number of Segments (>=1)pnv - Percentage Noverlap of Segments (0-100)Nb - Band Averaging, number of bands to averageWn - Cut-Off frequencies, used for filteringftype - Type of filter, high, low or stopn - Number of coefficients to use in the Butterworth filterOutput Var: q - structure with the following fields:xp - detrended xf = FrequenciesT - Periodsm - Magnitudea - Amplitudes - Power spectrum, Sxx(win), [Power]psdw - Power Spectral Density, Pxx(win), [Power/rad/sample]psdf - Power Spectral Density, Pxx(f), [Power/sample-freq]psdT - Power Spectral Density, Pxx(T), [Power*time-unit]conf - Upper and Lower Confidence Interval multiplication factors using chi-squared approach.Requirements: MATLAB 7 (R14)