Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
4
Merge Requests
4
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Institute of Technical Acoustics (ITA)
toolbox
Commits
5e870300
Commit
5e870300
authored
Nov 10, 2016
by
Jonas Stienen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing character problems that probably occurred after text encoding conversion.
parent
76109e96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
45 deletions
+45
-45
applications/VirtualAcoustics/openDAFF/OpenDAFFv1.7/daffv17_write.m
...ns/VirtualAcoustics/openDAFF/OpenDAFFv1.7/daffv17_write.m
+45
-45
No files found.
applications/VirtualAcoustics/openDAFF/OpenDAFFv1.7/daffv17_write.m
View file @
5e870300
...
@@ -20,7 +20,7 @@ function [] = daffv17_write( varargin )
...
@@ -20,7 +20,7 @@ function [] = daffv17_write( varargin )
% 'MPS' => Magnitude phase spectra,
% 'MPS' => Magnitude phase spectra,
% 'DFT' => discrete fourier spectra)
% 'DFT' => discrete fourier spectra)
% datafunc function Data function (delivers the data for a direction)
% datafunc function Data function (delivers the data for a direction)
% orient vector-3 Orientation [yaw pitch roll] angles [
�
]
% orient vector-3 Orientation [yaw pitch roll] angles []
% channels int Number of channels
% channels int Number of channels
%
%
% alphares float Resolution of alpha-angles
% alphares float Resolution of alpha-angles
...
@@ -361,17 +361,17 @@ function [] = daffv17_write( varargin )
...
@@ -361,17 +361,17 @@ function [] = daffv17_write( varargin )
fprintf('Content type: \t%s\n', contentStr);
fprintf('Content type: \t%s\n', contentStr);
fprintf('Num channels: \t%d\n', args.channels);
fprintf('Num channels: \t%d\n', args.channels);
fprintf('Num alpha points: \t%d\n', args.alphapoints);
fprintf('Num alpha points: \t%d\n', args.alphapoints);
fprintf('Alpha range: \t[%0.1f
�, %0.1f�
]\n', alphastart, alphaend);
fprintf('Alpha range: \t[%0.1f
, %0.1f
]\n', alphastart, alphaend);
fprintf('Alpha resolution: \t%0.1f
�
\n', args.alphares);
fprintf('Alpha resolution: \t%0.1f\n', args.alphares);
fprintf('Num beta points: \t%d\n', args.betapoints);
fprintf('Num beta points: \t%d\n', args.betapoints);
fprintf('Beta range: \t[%0.1f
�, %0.1f�
]\n', betastart, betaend);
fprintf('Beta range: \t[%0.1f
, %0.1f
]\n', betastart, betaend);
fprintf('Beta resolution: \t%0.1f
�
\n', args.betares);
fprintf('Beta resolution: \t%0.1f\n', args.betares);
fprintf('Measurement dist.: \t%0.2f m\n', args.mdist);
fprintf('Measurement dist.: \t%0.2f m\n', args.mdist);
fprintf('Reference value: \t%+0.1f dB\n', args.reference);
fprintf('Reference value: \t%+0.1f dB\n', args.reference);
fprintf('Orientation: \t(Y%+0.1f
�, P%+0.1f�, R%+0.1f�
)\n', ...
fprintf('Orientation: \t(Y%+0.1f
, P%+0.1f, R%+0.1f
)\n', ...
args.orient(1), args.orient(2), args.orient(3));
args.orient(1), args.orient(2), args.orient(3));
if strcmp(args.content, 'IR')
if strcmp(args.content, 'IR')
...
@@ -437,20 +437,20 @@ function [] = daffv17_write( varargin )
...
@@ -437,20 +437,20 @@ function [] = daffv17_write( varargin )
[channels, filterlength] = size(data);
[channels, filterlength] = size(data);
if( ~isa( data, 'double' ) )
if( ~isa( data, 'double' ) )
error( 'Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values', alpha, beta );
end
end
if isfield(props, 'samplerate')
if isfield(props, 'samplerate')
if (samplerate ~= props.samplerate)
if (samplerate ~= props.samplerate)
error( 'Dataset (A%0.1f
�, B%0.1f�
): Sampling rate does not match', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Sampling rate does not match', alpha, beta );
end
end
if (channels ~= args.channels)
if (channels ~= args.channels)
error( 'Dataset (A%0.1f
�, B%0.1f�
): Number of channels does not match', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Number of channels does not match', alpha, beta );
end
end
if (filterlength ~= props.filterlength)
if (filterlength ~= props.filterlength)
error( 'Dataset (A%0.1f
�, B%0.1f�
): Filter length does not match', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Filter length does not match', alpha, beta );
end
end
else
else
% Now set the global properties, if they have not been set yet
% Now set the global properties, if they have not been set yet
...
@@ -460,7 +460,7 @@ function [] = daffv17_write( varargin )
...
@@ -460,7 +460,7 @@ function [] = daffv17_write( varargin )
% Check filter length for 16-byte alignment
% Check filter length for 16-byte alignment
if( mod( filterlength, 4 ) ~= 0 )
if( mod( filterlength, 4 ) ~= 0 )
error( 'Dataset (A%0.1f
�, B%0.1f�
): Filter length is not a multiple of 4 (this is required for memory alignment)', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Filter length is not a multiple of 4 (this is required for memory alignment)', alpha, beta );
end
end
fprintf('Global properties: Sampling rate = %d Hz, filter length = %d\n',...
fprintf('Global properties: Sampling rate = %d Hz, filter length = %d\n',...
...
@@ -536,33 +536,33 @@ function [] = daffv17_write( varargin )
...
@@ -536,33 +536,33 @@ function [] = daffv17_write( varargin )
[channels, numfreqs] = size(data);
[channels, numfreqs] = size(data);
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
if isfield(props, 'freqs')
if isfield(props, 'freqs')
if (freqs ~= props.freqs)
if (freqs ~= props.freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Frequency support does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Frequency support does not match', alpha, beta) );
end
end
if (channels ~= args.channels)
if (channels ~= args.channels)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Number of channels does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Number of channels does not match', alpha, beta) );
end
end
else
else
% Checks on the frequency support
% Checks on the frequency support
if (numfreqs ~= size(freqs))
if (numfreqs ~= size(freqs))
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Frequency support does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Frequency support does not match', alpha, beta) );
end;
end;
if (min(freqs) <= 0)
if (min(freqs) <= 0)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be greater zero', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be greater zero', alpha, beta) );
end;
end;
if (sort(freqs) ~= freqs)
if (sort(freqs) ~= freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be stricly increasing', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be stricly increasing', alpha, beta) );
end
end
if (length(unique(freqs)) ~= length(freqs))
if (length(unique(freqs)) ~= length(freqs))
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be unique', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be unique', alpha, beta) );
end
end
% Now set the global properties, if they have not been set yet
% Now set the global properties, if they have not been set yet
...
@@ -575,7 +575,7 @@ function [] = daffv17_write( varargin )
...
@@ -575,7 +575,7 @@ function [] = daffv17_write( varargin )
% Important: Negative magnitudes are forbidden
% Important: Negative magnitudes are forbidden
if (min(min(data)) < 0)
if (min(min(data)) < 0)
error( 'Dataset (A%0.1f
�, B%0.1f�
): Contains negative magnitudes', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Contains negative magnitudes', alpha, beta );
end
end
...
@@ -603,29 +603,29 @@ function [] = daffv17_write( varargin )
...
@@ -603,29 +603,29 @@ function [] = daffv17_write( varargin )
[channels, numfreqs] = size(data);
[channels, numfreqs] = size(data);
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
if isfield(props, 'freqs')
if isfield(props, 'freqs')
if (freqs ~= props.freqs)
if (freqs ~= props.freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Frequency support does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Frequency support does not match', alpha, beta) );
end
end
if (channels ~= args.channels)
if (channels ~= args.channels)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Number of channels does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Number of channels does not match', alpha, beta) );
end
end
else
else
% Checks on the frequency support
% Checks on the frequency support
if (min(freqs) <= 0)
if (min(freqs) <= 0)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be greater zero', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be greater zero', alpha, beta) );
end;
end;
if (sort(freqs) ~= freqs)
if (sort(freqs) ~= freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be stricly increasing', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be stricly increasing', alpha, beta) );
end
end
if (length(unique(freqs)) ~= length(freqs))
if (length(unique(freqs)) ~= length(freqs))
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be unique', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be unique', alpha, beta) );
end
end
% Now set the global properties, if they have not been set yet
% Now set the global properties, if they have not been set yet
...
@@ -638,7 +638,7 @@ function [] = daffv17_write( varargin )
...
@@ -638,7 +638,7 @@ function [] = daffv17_write( varargin )
% Important: Phases must range between +-pi
% Important: Phases must range between +-pi
if (min(min(data)) < -pi) || (max(max(data)) > pi)
if (min(min(data)) < -pi) || (max(max(data)) > pi)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Phases must range between +-pi', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Phases must range between +-pi', alpha, beta) );
end
end
props.globalPeak = 0;
props.globalPeak = 0;
...
@@ -661,29 +661,29 @@ function [] = daffv17_write( varargin )
...
@@ -661,29 +661,29 @@ function [] = daffv17_write( varargin )
[channels, numfreqs] = size(data);
[channels, numfreqs] = size(data);
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values', alpha, beta) );
end
end
if isfield(props, 'freqs')
if isfield(props, 'freqs')
if (freqs ~= props.freqs)
if (freqs ~= props.freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Frequency support does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Frequency support does not match', alpha, beta) );
end
end
if (channels ~= args.channels)
if (channels ~= args.channels)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Number of channels does not match', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Number of channels does not match', alpha, beta) );
end
end
else
else
% Checks on the frequency support
% Checks on the frequency support
if (min(freqs) <= 0)
if (min(freqs) <= 0)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be greater zero', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be greater zero', alpha, beta) );
end;
end;
if (sort(freqs) ~= freqs)
if (sort(freqs) ~= freqs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be stricly increasing', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be stricly increasing', alpha, beta) );
end
end
if (length(unique(freqs)) ~= length(freqs))
if (length(unique(freqs)) ~= length(freqs))
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Support frequencies must be unique', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Support frequencies must be unique', alpha, beta) );
end
end
% Now set the global properties, if they have not been set yet
% Now set the global properties, if they have not been set yet
...
@@ -716,31 +716,31 @@ function [] = daffv17_write( varargin )
...
@@ -716,31 +716,31 @@ function [] = daffv17_write( varargin )
[ channels, numDFTCoeffs ] = size( data );
[ channels, numDFTCoeffs ] = size( data );
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values', alpha, beta) );
end
end
% test something (TODO)
% test something (TODO)
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values', alpha, beta) );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values', alpha, beta) );
end
end
if (class(isSymetric) ~= 'logical')
if (class(isSymetric) ~= 'logical')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): third parameter isSymetric must be logical', alpha, beta));
error( sprintf('Dataset (A%0.1f
, B%0.1f
): third parameter isSymetric must be logical', alpha, beta));
end
end
if isfield( props, 'samplerate' )
if isfield( props, 'samplerate' )
if ( sampleRate ~= props.sampleRate )
if ( sampleRate ~= props.sampleRate )
error( sprintf( 'Dataset (A%0.1f
�, B%0.1f�
): Sample rate does not match', alpha, beta ) );
error( sprintf( 'Dataset (A%0.1f
, B%0.1f
): Sample rate does not match', alpha, beta ) );
end
end
end
end
if isfield(props, 'numDFTCoeffs')
if isfield(props, 'numDFTCoeffs')
if (numDFTCoeffs ~= props.numDFTCoeffs)
if (numDFTCoeffs ~= props.numDFTCoeffs)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Number of discrete fourier spectra coefficients is not constant', alpha, beta));
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Number of discrete fourier spectra coefficients is not constant', alpha, beta));
end
end
else
else
if (numDFTCoeffs <= 0)
if (numDFTCoeffs <= 0)
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Number of discrete fourier spectra coefficients must be greater than zero', alpha, beta));
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Number of discrete fourier spectra coefficients must be greater than zero', alpha, beta));
end
end
props.numDFTCoeffs = numDFTCoeffs;
props.numDFTCoeffs = numDFTCoeffs;
...
@@ -992,13 +992,13 @@ function [] = daffv17_write( varargin )
...
@@ -992,13 +992,13 @@ function [] = daffv17_write( varargin )
[ data, ~, ~ ] = args.datafunc( alpha, beta, args.userdata );
[ data, ~, ~ ] = args.datafunc( alpha, beta, args.userdata );
if( ~isa( data, 'double' ) )
if( ~isa( data, 'double' ) )
error( 'Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values', alpha, beta );
error( 'Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values', alpha, beta );
end
end
% Clipping check
% Clipping check
peak = max(max(abs(data)));
peak = max(max(abs(data)));
if ((peak > 1) && (~args.quiet))
if ((peak > 1) && (~args.quiet))
warning( 'Dataset (A%0.1f
�, B%0.1f�
): Clipping occured (peak %0.3f)', alpha, beta, peak );
warning( 'Dataset (A%0.1f
, B%0.1f
): Clipping occured (peak %0.3f)', alpha, beta, peak );
end
end
for c=1:args.channels
for c=1:args.channels
...
@@ -1049,13 +1049,13 @@ function [] = daffv17_write( varargin )
...
@@ -1049,13 +1049,13 @@ function [] = daffv17_write( varargin )
[channels, numfreqs] = size(data);
[channels, numfreqs] = size(data);
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
% Clipping check
% Clipping check
peak = max(max(data));
peak = max(max(data));
if ((peak > 1) && (~args.quiet))
if ((peak > 1) && (~args.quiet))
warning( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Clipping occured (peak %0.3f)', alpha, beta, peak) );
warning( sprintf('Dataset (A%0.1f
, B%0.1f
): Clipping occured (peak %0.3f)', alpha, beta, peak) );
end
end
%x{a,b}.dataOffset = zeros(1, args.channels);
%x{a,b}.dataOffset = zeros(1, args.channels);
...
@@ -1092,7 +1092,7 @@ function [] = daffv17_write( varargin )
...
@@ -1092,7 +1092,7 @@ function [] = daffv17_write( varargin )
[channels, numfreqs] = size(data);
[channels, numfreqs] = size(data);
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
...
@@ -1128,7 +1128,7 @@ function [] = daffv17_write( varargin )
...
@@ -1128,7 +1128,7 @@ function [] = daffv17_write( varargin )
[ channels, numfreqs ] = size( data );
[ channels, numfreqs ] = size( data );
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
...
@@ -1168,7 +1168,7 @@ function [] = daffv17_write( varargin )
...
@@ -1168,7 +1168,7 @@ function [] = daffv17_write( varargin )
[ channels, numfreqs ] = size( data );
[ channels, numfreqs ] = size( data );
if (class(data) ~= 'double')
if (class(data) ~= 'double')
error( sprintf('Dataset (A%0.1f
�, B%0.1f�
): Data function must deliver double values') );
error( sprintf('Dataset (A%0.1f
, B%0.1f
): Data function must deliver double values') );
end
end
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
%x{a,b}.dataOffset = zeros(1, args.channels); TODO
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment