Commit 6ae17bf4 authored by Michael Kohnen's avatar Michael Kohnen

Merge branch 'master' of http://git.rwth-aachen.de/ita/toolbox

parents c1c9fdc9 6c4f8fb0
...@@ -66,18 +66,24 @@ blockSize = floor(1/20*length(x_data)); ...@@ -66,18 +66,24 @@ blockSize = floor(1/20*length(x_data));
tailFormat = struct('LineWidth',1,'Color','r','LineStyle','-'); tailFormat = struct('LineWidth',1,'Color','r','LineStyle','-');
headFormat = struct('LineStyle','none','Marker','o','MarkerSize',6,... headFormat = struct('LineStyle','none','Marker','o','MarkerSize',6,...
'Color','b'); 'Color','b');
pointFormat = struct('LineStyle','none','Marker','o','MarkerSize',6,...
'Color','g');
plotPoints = 0;
returnFrames = 0;
colorSwitch = 0;
moveTail = 0;
%parse out the inputs %parse out the inputs
argCount = nargin - 3; argCount = nargin - 3;
for i = 1:2:argCount for index = 1:2:argCount
% caseVar = varargin{i} % caseVar = varargin{i}
switch varargin{i} switch varargin{index}
case 'cFigure' case 'cFigure'
cFigure = varargin{i+1}; cFigure = varargin{index+1};
%get the original size: %get the original size:
cAxes = get(cFigure,'CurrentAxes'); cAxes = get(cFigure,'CurrentAxes');
xLim = get(cAxes,'XLim'); xLim = get(cAxes,'XLim');
...@@ -112,15 +118,27 @@ for i = 1:2:argCount ...@@ -112,15 +118,27 @@ for i = 1:2:argCount
axis([xLim, yLim, zLim]); axis([xLim, yLim, zLim]);
case 'blockSize' case 'blockSize'
blockSize = varargin{i+1}; blockSize = varargin{index+1};
case 'Frequency' case 'Frequency'
freq = varargin{i+1}; freq = varargin{index+1};
case 'tailFormat' case 'tailFormat'
tailFormat = varargin{i+1}; tailFormat = varargin{index+1};
case 'headFormat' case 'headFormat'
headFormat = varargin{i+1}; headFormat = varargin{index+1};
case 'plotPoints'
plotPoints = varargin{index+1};
case 'returnFrames'
returnFrames = varargin{index+1};
case 'colorSwitch'
colorSwitch = varargin{index+1};
case 'moveTail'
moveTail = varargin{index+1};
end end
end end
...@@ -152,43 +170,126 @@ pauseTime = 1./freq; ...@@ -152,43 +170,126 @@ pauseTime = 1./freq;
n_start = 1; n_start = 1;
n_stop = 1; n_stop = 1;
frames = [];
deleteList = [];
%put on the starting point %put on the starting point
plot3(x_data(n_start:n_stop),... deleteList{end+1} = plot3(x_data(n_start:n_stop),...
y_data(n_start:n_stop),... y_data(n_start:n_stop),...
z_data(n_start:n_stop),tailFormat); z_data(n_start:n_stop),tailFormat);
plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),headFormat); deleteList{end+1} = plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),headFormat);
if returnFrames
frames{end+1} = getframe(gcf);
end
% prepare the colormap
if colorSwitch
colormap('jet');
colorValues = colormap;
colorValues = [colorValues;[0 0 0]];
indexFactor = 3.882/1.335;
else
indexFactor = 1;
end
if length(moveTail) > 1
tailX_data = squeeze(moveTail(:,1,:));
tailY_data = squeeze(moveTail(:,2,:));
tailZ_data = squeeze(moveTail(:,3,:));
end
n_blocks = length(x_data)/blockSize;
i_blocks = 0;
%playback! %playback!
for n = 1:1:length(x_data) for n = 1:1:ceil(length(x_data)+length(x_data)/(n_blocks*indexFactor))
a = tic; a = tic;
%delete the previous plot
hChild = get(cAxes,'Children');
delete(hChild(1:2));
if n <= blockSize if n <= blockSize*(i_blocks + 1)
n_start = 1; n_start = blockSize*i_blocks + 1;
n_stop = n; n_stop = n;
else else
n_start = n_start + 1; i_blocks = i_blocks + 1;
n_stop = n_stop + 1; n_start = blockSize*i_blocks + 1;
n_stop = n;
deleteList = deleteList(2:end);
end
%delete the previous plot
for index = 1:length(deleteList)
delete(deleteList{index});
end
deleteList = [];
if n > length(x_data)
% n_start = 1;
n_stop = length(x_data);
end end
%new plot %new plot
plot3(x_data(n_start:n_stop),... deleteList{end+1} = plot3(x_data(n_start:n_stop),...
y_data(n_start:n_stop),... y_data(n_start:n_stop),...
z_data(n_start:n_stop),tailFormat); z_data(n_start:n_stop),tailFormat);
plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),headFormat);
if plotPoints
for index = 1:n_stop-1
if colorSwitch
colorIndex = round((n-(index-1))*indexFactor);
if colorIndex >= length(colorValues)
colorIndex = length(colorValues);
end
pointColor = colorValues(colorIndex,:);
pointFormat = struct('LineStyle','none','Marker','o','MarkerSize',6,'Color',pointColor);
end
if moveTail == 0
deleteList{end+1} = plot3(x_data(index), y_data(index), z_data(index),pointFormat);
else
if colorIndex ~= length(colorValues)
% point
deleteList{end+1} = plot3(tailX_data(index,colorIndex), tailY_data(index,colorIndex), tailZ_data(index,colorIndex),pointFormat);
end
% tail
deleteList{end+1} = plot3(tailX_data(index,1:colorIndex),...
tailY_data(index,1:colorIndex),...
tailZ_data(index,1:colorIndex),tailFormat);
end
end
deleteList{end+1} = plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),headFormat);
else
deleteList{end+1} = plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),headFormat);
end
drawnow; drawnow;
if returnFrames
frames{end+1} = getframe(gcf);
end
%update playback refresh rate %update playback refresh rate
b = toc(a); b = toc(a);
pause(pauseTime-b); pause(pauseTime-b);
end end
if plotPoints
plot3(x_data(n_stop), y_data(n_stop), z_data(n_stop),pointFormat);
drawnow;
if returnFrames
frames{end+1} = getframe(gcf);
end
end
set(cAxes,'NextPlot',oldNextPlot); set(cAxes,'NextPlot',oldNextPlot);
% fprintf('Finished\n'); % fprintf('Finished\n');
if nargout == 1 if nargout == 1
varargout{1} = cFigure; varargout{1} = cFigure;
end end
if returnFrames
varargout{2} = frames;
end
...@@ -47,7 +47,11 @@ sArgs = struct('pos1_array','itaMicArray','pos2_f','numeric','pos3_steering_th', ...@@ -47,7 +47,11 @@ sArgs = struct('pos1_array','itaMicArray','pos2_f','numeric','pos3_steering_th',
%% do the calculation %% do the calculation
% positions of array microphones % positions of array microphones
arrayPositions = array.cart; arrayPositions = array.cart;
if isempty(array.weights) || numel(array.weights) ~= array.nPoints
weights = array.w;
else
weights = array.weights;
end
% make a matrix with spherical coordinates for the unit sphere with % make a matrix with spherical coordinates for the unit sphere with
% given angular resolution % given angular resolution
resolution = 1; resolution = 1;
...@@ -67,7 +71,7 @@ k = 2*pi*f/double(ita_constants('c')); ...@@ -67,7 +71,7 @@ k = 2*pi*f/double(ita_constants('c'));
v = squeeze(ita_beam_steeringVector(k,arrayPositions,scanPositions,sArgs.wavetype)); v = squeeze(ita_beam_steeringVector(k,arrayPositions,scanPositions,sArgs.wavetype));
% ... and multiply with the manifold vector for the steering % ... and multiply with the manifold vector for the steering
% direction to get the beampattern % direction to get the beampattern
v_steer = ita_beam_steeringVector(k,arrayPositions,steer_vec,sArgs.wavetype).'; v_steer = weights(:).*ita_beam_steeringVector(k,arrayPositions,steer_vec,sArgs.wavetype).';
v = v'*v_steer./sum(abs(v_steer).^2); v = v'*v_steer./sum(abs(v_steer).^2);
B = reshape(v,numel(theta),numel(phi)); B = reshape(v,numel(theta),numel(phi));
...@@ -75,7 +79,7 @@ B = B./max(abs(B(:))); % normalize to maximum ...@@ -75,7 +79,7 @@ B = B./max(abs(B(:))); % normalize to maximum
if ~strcmpi(sArgs.plotPlane,'none') if ~strcmpi(sArgs.plotPlane,'none')
v = itaResult(v(:).'./max(abs(v(:))),f,'freq'); v = itaResult(v(:).'./max(abs(v(:))),f,'freq');
v.channelCoordinates = itaCoordinates(scanPositions.'); v.channelCoordinates = itaCoordinates(scanPositions);
if (strcmpi(sArgs.plotPlane,'xyz') || strcmpi(sArgs.plotPlane,'3d')) if (strcmpi(sArgs.plotPlane,'xyz') || strcmpi(sArgs.plotPlane,'3d'))
switch sArgs.plotType switch sArgs.plotType
case 'lin' case 'lin'
......
...@@ -51,7 +51,7 @@ end ...@@ -51,7 +51,7 @@ end
while true while true
coordsCart = eq_point_set(2,sArgs.nPoints).'; coordsCart = eq_point_set(2,sArgs.nPoints).';
sampling = itaSamplingSph(coordsCart,'cart'); sampling = itaSamplingSph(coordsCart,'cart');
Y = mbe_sph_base(sampling,Nmax); Y = ita_sph_base(sampling,Nmax);
condNum = cond(Y); condNum = cond(Y);
if condNum < sArgs.condSHT if condNum < sArgs.condSHT
break; break;
......
...@@ -52,7 +52,7 @@ end ...@@ -52,7 +52,7 @@ end
while true while true
coordsCart = calculate_spiral_points(sArgs.nPoints); coordsCart = calculate_spiral_points(sArgs.nPoints);
sampling = itaSamplingSph(coordsCart,'sph'); sampling = itaSamplingSph(coordsCart,'sph');
Y = mbe_sph_base(sampling,Nmax); Y = ita_sph_base(sampling,Nmax);
condNum = cond(Y); condNum = cond(Y);
if condNum < sArgs.condSHT if condNum < sArgs.condSHT
break; break;
......
...@@ -5,13 +5,9 @@ function [ varargout ] = comet3(this,varargin ) ...@@ -5,13 +5,9 @@ function [ varargout ] = comet3(this,varargin )
% You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder. % You can find the license for this m-file in the license.txt file in the ITA-Toolbox folder.
% </ITA-Toolbox> % </ITA-Toolbox>
hFig = PlotComet_3D(this.x, this.y, this.z, varargin{:}); [hFig, frames] = PlotComet_3D(this.x, this.y, this.z, varargin{:});
xlabel('X');
ylabel('Y');
zlabel('Z');
axis equal vis3d
if nargout if nargout
varargout = {hFig}; varargout = {hFig,frames};
else else
varargout = {}; varargout = {};
end end
......
...@@ -5,52 +5,56 @@ ...@@ -5,52 +5,56 @@
******************************************************************************** ********************************************************************************
******************************************************************************** ********************************************************************************
** ** ** **
** (C) All rights reserved. 2008-2016 ** ** Copyright (c) 2011 **
** ** ** Institute of Technical Acoustics (RWTH Aachen University) **
** The ITA-Toolbox for MATLAB is a non-commercial tool and should only be ** ** All rights reserved. **
** used for non-commercial work, e.g. self-study, research without financial **
** profit. The Institute of Technical Acoustics at RWTH Aachen University **
** (in the following short: ITA ) is not responsible for any damage caused **
** by the use of the ITA-Toolbox. **
** **
** The ITA-Toolbox is provided as is, and the Institute does not offer any **
** support for this Toolbox. The source code may be edited. Improvements **
** should be send to the developer team to be included in future versions **
** of the ITA-Toolbox with acknowledgments to the editors. **
** **
** Users of ITA-Toolbox are kindly asked to add the following line in the **
** Acknowledgments section in publications if the ITA-Toolbox was used in **
** this particular work or research. **
** **
** Text to add: "The ITA-Toolbox for MATLAB developed at the Institute of **
** Technical Acoustics at RWTH Aachen has been used for data processing." **
** **
** Distribution of the ITA-Toolbox without an official allowance by the **
** Institute of Technial Acoustics is prohibited. The use of ITA-Toolbox **
** for any profitable work, e.g. acoustic consulting, prototype developement **
** is prohibited as not officially allowed by the Institute of Technical **
** Acoustics at RWTH Aachen University otherwise. **
** **
** It is prohibited to distribute THIS APPLICATIONS folder developed for the **
** ITA-Toolbox by the ITA under any circumstances. **
** **
** A free license key for the kernel can be obtained via **
** http://ita-toolbox.org/ **
** for non-commercial use. **
** ** ** **
** Redistribution and use in source and binary forms, with or without **
** modification, are permitted provided that the following conditions are **
** met: **
** **
** 1. Redistributions of source code must retain the above copyright **
** notice, this list of conditions and the following disclaimer. **
** 2. Redistributions in binary form must reproduce the above copyright **
** notice, this list of conditions and the following disclaimer in the **
** documentation and/or other materials provided with the distribution. **
** 3. All advertising materials mentioning features or use of this **
** software must display the following acknowledgement: **
** **
** This product includes software developed by the **
** Institute of Technical Acoustics (RWTH Aachen University). **
** **
** 4. Neither the name of the Institute of Technical Acoustics (RWTH **
** Aachen University), nor the names of its contributors may be used to **
** endorse or promote products derived from this software without **
** specific prior written permission. **
** **
** THIS SOFTWARE IS PROVIDED BY THE INSTITUTE OF TECHNICAL ACOUSTICS (RWTH **
** AACHEN UNIVERSITY) ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, **
** INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY **
** AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL **
** INSTITUTE OF TECHNICAL ACOUSTICS (RWTH AACHEN UNIVERSITY) BE LIABLE FOR **
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL **
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS **
** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) **
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, **
** STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN **
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE **
** POSSIBILITY OF SUCH DAMAGE. **
** **
******************************************************************************** ********************************************************************************
** ** ** **
** Developed at the Institute of Technical Acoustics, ** ** Developed at the Institute of Technical Acoustics, **
** RWTH Aachen University, Kopernikusstr. 5, 52074 Aachen ** ** RWTH Aachen University, Kopernikusstr. 5, 52074 Aachen, Germany **
** Head: Prof. Dr. rer. nat. Michael Vorlaender ** ** Head: Prof. Dr. rer. nat. Michael Vorlaender **
** ** ** **
** Active Developers: ** ** Active Developers: **
** M.Sc. Marco Berzborn ** ** M.Sc. Marco Berzborn **
** Dipl.-Ing. Ramona Bomhardt ** ** Dipl.-Ing. Ramona Bomhardt **
** Dipl.-Ing. Johannes Klein ** ** Dipl.-Ing. Johannes Klein **
** Dipl.-Ing. Jan-Gerrit Richter ** ** Dipl.-Ing. Jan-Gerrit Richter **
** ** ** **
** Former Developers: ** ** Former Developers: **
** Dr.-Ing. Pascal Dietrich ** ** Dr.-Ing. Pascal Dietrich **
** Dr.-Ing. Martin Guski ** ** Dr.-Ing. Martin Guski **
** Dr.-Ing. Bruno Masiero ** ** Dr.-Ing. Bruno Masiero **
...@@ -58,7 +62,7 @@ ...@@ -58,7 +62,7 @@
** Dr.-Ing. Martin Pollow ** ** Dr.-Ing. Martin Pollow **
** Dr.-Ing. Roman Scharrer ** ** Dr.-Ing. Roman Scharrer **
** ** ** **
** Contact: toolbox-dev@akustik.rwth-aachen.de ** ** Contact: toolbox-dev@akustik.rwth-aachen.de **
** ** ** **
******************************************************************************** ********************************************************************************
******************************************************************************** ********************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment