Code covered by the BSD License
-
ACdsgn(Fs)
-
ArgStruct=parseArgs(args,ArgS...
Helper function for parsing varargin.
-
[Fsn, p, q, errors]=get_p_q2(...
-
[SP, f, bin_size, num_average...
% pressure_spectra: Calculates an accurate estimate of the pressure spectra
-
[SP, f, num_averages_out]=spe...
% spectra_estimate: Is a rough estimate of the pressure spectra
-
[SP2, mean_array2]=sub_mean(S...
% sub_mean: Removes the running average from a time record given a sampling rate and high pass cutoff frequency.
-
[SPa]=test_pressure_spectra(d...
% test_spectra_estimate: runs demos for the pressure spectra program.
-
[bin_size, num_averages_out, ...
% number_of_averages: Calculates the number of points not overlapped from the array size, bin size, and number of averages
-
[bz, az]=bessel_digital(Fs, F...
% bessel_digital: creates a digital low pass bessel filter of order n
-
[cfa, SP, f, f_cal]=mic_calib...
% mic_calib: Uses a flat top window to calibrate using A-weighted or Linear weighting
-
[ftwcf]=window_correction_fac...
% window_correction_factor: Computes the factor for calibrating a Fourier Transform given specific processing parameters
-
[m2]=geospace(a, b, n, flag)
% geospace: caculates a geometric sequence or psuedogeometric sequence from a to b with n elements
-
[prms]=rms_val(p, dim)
% rms_val: Calculates the rms value along a specific dimension
-
[varargout]=convert_double(va...
% This program converts the inputs into double precision arrays. Then
-
[w]=flat_top(N, type)
% Flat top windows are used for calibration, because the wide main lobe
-
[y, x, a]=match_height_and_sl...
% match_height_and_slopes2: creates a quartic with specifed height and slope at the end points.
-
[y2, num_settle_pts, settling...
% filter_settling_data: Creates data to append to a time record for settling a filter
-
[y2]=remove_filter_settling_d...
% remove_filter_settling_data: removes data added to time records to settle the filter
-
[yAC, errors]=ACweight_time_f...
% ACweight_time_filter: Applies an A or C weighting time filter to a sound recording
-
[y]=moving(x,m,fun)
MOVING will compute moving averages of order n (best taken as odd)
-
[y_out, b, a]=bessel_antialia...
% bessel_antialias: applies an antialiasing digital Bessel filter
-
[y_out, t_out, b, a]=bessel_d...
% bessel_down_sample: applies an antialiasing digital Bessel filter
-
[y_out, x_out, y_in]=resample...
% resample_interp3: resamples using interp1 with additional options
-
h=subaxis(varargin)
SUBAXIS Create axes in tiled positions. (just like subplot)
-
loc=LMSloc(X)
-
View all files
from
Calibrated Spectral Analysis
by Edward Zechmann
Simple Fourier Spectral Analysis of sound pressure time record.
|
| [prms]=rms_val(p, dim)
|
function [prms]=rms_val(p, dim)
% % rms_val: Calculates the rms value along a specific dimension
% %
% % Syntax: [prms]=rms_val(p, dim);
% %
% % **********************************************************************
% %
% % Description
% %
% % [prms]=rms_val(p, dim);
% %
% % Returns a matrix prms of root-mean-square values of the input variable
% % p calcualted along dimension dim.
% %
% % If dim is not specified or is empty, then the rms value is calculated
% % along the first non-singleton dimension. This behavior is consistent
% % with the built-in Matlab sum program.
% %
% % **********************************************************************
% %
% % Input variables
% %
% % p is the input variable which is used to calculate the rms values.
% %
% % dim is the dimension to calculate the rms values along.
% %
% % **********************************************************************
%
%
% Example='1';
%
% % Example using random data from a standard normal distribution
% % whos rms value is one.
%
% p=randn(10, 1000);
%
% p_rms=rms_val(p, 2);
%
% % p should return a column vector of length 10 with values nearly 1.
%
%
% Example='2';
%
% % Example using random data from a standard normal distribution
% % whos rms value is one.
%
% p=rand(10, 1000);
%
% p_rms=rms_val(p, 2);
%
% % p should return a column vector of length 10 with values
% % approximately 1/sqrt(3)~0.5774.
%
%
% % **********************************************************************
% %
% % written by Edward L. Zechmann
% %
% % date 11 December 2007
% %
% % **********************************************************************
% %
% % Please feel free to modify this code.
% %
% % See also: rms by George Scott Copeland on Matlab Central File Exchange
% %
if (nargin < 1 || isempty(p)) || ~isnumeric(p)
p=randn(1, 50000);
end
if (nargin < 2 || isempty(dim)) || ~isnumeric(dim)
dim=[];
end
dim=round(dim);
num_dims = ndims(p);
if dim > num_dims
prms=p;
elseif dim < 1
prms=0;
else
if ~isempty(dim)
n=sqrt(size(p, dim));
prms=sqrt(sum(p.^2, dim))./n;
else
num=numel(p);
buf=sqrt(sum(p.^2));
prms=1./sqrt(num./numel(buf)).*buf;
end
end
|
|
Contact us at files@mathworks.com