Commit b7835ac6 authored by Jan-Gerrit Richter's avatar Jan-Gerrit Richter

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

parents ef21eaa1 a750c6b4
......@@ -684,11 +684,7 @@ classdef itaHRTF < itaAudio
end
%HRTFout = this.direction(idxCoord);
end
function this = buildsearchdatabase(this)
this.dirCoord = this.dirCoord.build_search_database;
end
end
function obj = direction(this, idxCoord)
%return the HRTF (L&R) for a/multiple given direction indices
......@@ -752,7 +748,7 @@ classdef itaHRTF < itaAudio
earCoords = this.getEar('L').channelCoordinates;
switch dirID
case {'phi_deg', 'p'}
phiValues = uniquetol(earCoords.phi_deg);
phiValues = uniquetol(earCoords.phi_deg,0.0001);
[~,index] = min(abs(phiValues - dir_deg));
exactPhiValue = phiValues(index);
tmp = earCoords.n(earCoords.phi_deg == exactPhiValue);
......@@ -760,13 +756,15 @@ classdef itaHRTF < itaAudio
slice = this.findnearestHRTF(thetaU,dir_deg);
case {'theta_deg', 't'}
thetaValues = uniquetol(earCoords.theta_deg);
thetaValues = uniquetol(earCoords.theta_deg,0.0001);
[~,index] = min(abs(thetaValues - dir_deg));
exactThetaValue = thetaValues(index);
tmp = earCoords.n(earCoords.theta_deg == exactThetaValue);
phiU = tmp.phi_deg;
slice = this.findnearestHRTF(dir_deg,phiU);
slice = this.direction(find(earCoords.theta_deg == exactThetaValue));
% tmp = earCoords.n(earCoords.theta_deg == exactThetaValue);
% phiU = tmp.phi_deg;
%
% slice = this.findnearestHRTF(dir_deg,phiU);
end
end
......@@ -1283,7 +1281,7 @@ classdef itaHRTF < itaAudio
% init
sArgs = struct('pos1_data','itaHRTF', 'method', 'phase_delay', 'filter' , [200 2000] ,...
'thresh','10dB','energy',true,'centroid',false,'reshape',true,...
'theta_deg',[],'plot_type','color');
'theta_deg',[],'plot_type','color','axes_handle',[]);
[this,sArgs] = ita_parse_arguments(sArgs,varargin);
% calculate ITD
......@@ -1313,8 +1311,13 @@ classdef itaHRTF < itaAudio
%..............................................................
% create figure
position = get(0,'ScreenSize');
figure
set(gcf,'Position',[10 50 position(3:4)*0.85]);
if isempty(sArgs.axes_handle)
figure
set(gcf,'Position',[10 50 position(3:4)*0.85]);
else
axes(sArgs.axes_handle);
hold on;
end
if strcmp(sArgs.method,'phase_delay') && ischar(sArgs.filter) % frequency dependent ITD
pcolor(phiC_deg,this.freqVector,ITD)
title(strcat('\phi = ', num2str(round(thetaC_deg)), '�'))
......
......@@ -325,7 +325,7 @@ classdef itaOptitrack < handle
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion.m'))
delete(fullfile(Optitrack_obj.dllPath,'NatNet_SDK_2.10\NatNetSDK\Samples\Matlab\quaternion-license.txt'))
fprintf( '[itaOptitrack] NatNet SDK has been successfully downloaded.\n' );
fprintf( '[itaOptitrack] NatNet SDK 2.10 has been successfully downloaded.\n' );
end
......
......@@ -259,16 +259,20 @@ classdef itaOrientation
% set view vector, nPoints x 3, mtx(vx vy vz) [double]
assert( isequal(size(value),size(this.view)),['Size of input must be ',num2str(this.nPoints),' x 3, mtx(vx vy vz) [double].'])
%NOTE PSC:
%-normalization of up and view already done in ita_vu2quat()
%-specify the dimension to row vectors when using cross()
% calculate side vector and new up vector
if isequal(value,this.up) % case new view vector is old up vector
s = cross(this.view,this.up);
u = normr(cross(s,this.up));
s = cross(this.view,this.up, 2);
u = cross(s,this.up, 2);
elseif isequal(value,-this.up) % case new view vector is negative old up vector
s = cross(this.view,-this.up);
u = normr(cross(s,this.up));
s = cross(this.view,-this.up,2);
u = cross(s,this.up, 2);
else
s = cross(value,this.up);
u = normr(cross(s,value));
s = cross(value,this.up, 2);
u = cross(s,value, 2);
end
this.mOrient = ita_vu2quat(value,u);
end
......@@ -277,16 +281,20 @@ classdef itaOrientation
% set up vector, nPoints x 3, mtx(ux uy uz) [double]
assert( isequal(size(value),size(this.up)),['Size of input must be ',num2str(this.nPoints),' x 3, mtx(ux uy uz) [double].'])
%NOTE PSC:
%-normalization of up and view already done in ita_vu2quat()
%-specify the dimension to row vectors when using cross()
% calculate side vector and new view vector
if isequal(value,this.view) % case new up vector is old view vector
s = cross(this.view,this.up);
v = normr(cross(this.view,s));
s = cross(this.view,this.up, 2);
v = cross(this.view,s, 2);
elseif isequal(value,-this.view) % case new up vector is negative old view vector
s = cross(this.view,-this.up);
v = normr(cross(this.view,s));
s = cross(this.view,-this.up, 2);
v = cross(this.view,s, 2);
else
s = cross(this.view,value);
v = normr(cross(value,s));
s = cross(this.view,value, 2);
v = cross(value,s, 2);
end
this.mOrient = ita_vu2quat(v,value);
end
......@@ -399,4 +407,13 @@ classdef itaOrientation
end
%% Create functions
methods(Static = true)
function obj = FromViewUp(view, up)
assert( size(view, 2) == 3 && size(up, 2) == 3,'Size of both inputs must be N x 3 [double].' )
assert( isequal(size(view),size(up)),'Number of view and up vectors must be the same.' )
obj = itaOrientation(ita_vu2quat(view, up));
end
end
end
......@@ -63,7 +63,7 @@ else
end
% calculate side vector
s = cross(v, u);
s = cross(v, u, 2); %NOTE PSC: Matlab thinks in column vectors, so this would fail in case of two 3x3 matrices when not transposing v and u.
% build rotation matrix
vec_ent = size(v,1);
......
function [polar_DEG] = ita_elevation2polarDEG(ele_DEG)
%ELEVATION2POLAR Converts elevation angle to polar angle
% Elevation angle, where frontal direction is 0°, to polar angle, where
% above direction is 0°
polar_DEG=90-ele_DEG;
end
function [ele_DEG] = ita_polar2elevationDEG(polar_DEG)
%ELEVATION2POLAR Converts elevation angle to polar angle
% To Elevation angle, where frontal direction is 0°, from polar angle, where
% above direction is 0°
ele_DEG=90-polar_DEG;
end
......@@ -272,7 +272,7 @@ classdef load_ac3d
line( obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(1)) * invertAxes(1), ...
obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(2)) * invertAxes(2), ...
obj.nodes([polyNodes; polyNodes(1)],component2axesMapping(3)) * invertAxes(3), ...
'Color', [.1 .1 .1]);
'Color', [.6 .6 .6]);
end
else
% display GA model
......@@ -405,10 +405,14 @@ classdef load_ac3d
[A, S] = obj.getEquivalentAbsorptionArea_sabine();
end
function RT = getReverbTime(obj, material_path, sabine_or_eyring, airAbsorption, portal_surface_materials)
if nargin < 3
function RT = getReverbTime(obj, material_path, sabine_or_eyring, factor, airAbsorption, portal_surface_materials)
if nargin < 4
airAbsorption = zeros(1,31);
end
if nargin < 3
factor = 0.161;
end
if nargin < 3
sabine_or_eyring = 'eyring';
end
......@@ -416,7 +420,7 @@ classdef load_ac3d
material_path = '..\RavenDatabase\MaterialDatabase';
end
if nargin > 4
if nargin > 5
if strcmp(sabine_or_eyring, 'eyring')
[A, S] = obj.getEquivalentAbsorptionArea_eyring(material_path, portal_surface_materials);
else
......@@ -438,7 +442,7 @@ classdef load_ac3d
%RT = 0.163 .* obj.totalVolume ./ A;
% RT = (2.76 / sqrt(273.15 + room_temperature)) .* (obj.totalVolume ./ A);
RT = 0.163 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
RT = 0.161 .* obj.totalVolume ./ (A + 4*airAbsorption*obj.totalVolume);
end
% get surface area of given material
......
......@@ -439,7 +439,7 @@ else
% Create an empty helper dataset, which contains all directions
% (angular pairs). Then we can just iterate over all records,
% making iteration over directions a lot less complicated
props.dataset = daff_create_dataset('channels', props.channels, ...
props.dataset = daffv15_create_dataset('channels', props.channels, ...
'alpharange', props.alpharange, ...
'alphapoints', props.alphapoints, ...
'betarange', props.betarange, ...
......@@ -542,7 +542,9 @@ if strcmpi(props.content, 'MS')
% Frequencies must be provided
if ~isfield(props.dataset, 'freqs')
error('When writing magnitude spectrum content, you must specify ''freqs''');
warning('When writing magnitude spectrum content, you should specify ''freqs''');
warning('Frequency vector set to ANSI center frequencies (20 Hz - 20 kHz)');
props.dataset.freqs = ita_ANSI_center_frequencies;
end
props.numfreqs = length(props.dataset.freqs);
......
......@@ -18,7 +18,7 @@ function [ freqs, mags, metadata ] = dfBulbMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum of bulb shape for higher frequencies';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDiscMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum in cube shape weighted by frequency (for fun!)';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDipoleMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dipole magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDiscMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'magnitude spectrum in disc shape weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfFrontalDiracMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dirac in frontal direction magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfFrontalHemisphereMS( alpha, beta, basepat
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Dirac in frontal direction magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfOmnidirectionalMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Omnidirectional magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfDipoleMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Quadrupole magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfStarMS( alpha, beta, basepath )
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Example magnitude spectrum in star shape weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,7 @@ function [ freqs, mags, metadata ] = dfOmnidirectionalMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Omnidirectional magnitude spectrum';
for c=1:channels
for f=1:length(freqs)
......
......@@ -14,7 +14,8 @@ function [ freqs, mags, metadata ] = dfUpperHemisphereMS( alpha, beta, basepath
channels = 1;
mags = zeros(channels, length(freqs));
metadata = [];
metadata.desc = 'Upper hemisphere magnitude spectrum weighted by frequency';
for c=1:channels
for f=1:length(freqs)
......
......@@ -25,7 +25,7 @@ channels = 1;
orient = [0 0 0];
daff_write('filename', '../MS Frontal dirac.daff', ...
daffv15_write('filename', '../MS Frontal dirac.daff', ...
'content', 'ms', ...
'datafunc', @dfFrontalDiracMS, ...
'channels', channels, ...
......@@ -33,7 +33,7 @@ daff_write('filename', '../MS Frontal dirac.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Frontal hemisphere.daff', ...
daffv15_write('filename', '../MS Frontal hemisphere.daff', ...
'content', 'ms', ...
'datafunc', @dfFrontalHemisphereMS, ...
'channels', channels, ...
......@@ -41,7 +41,7 @@ daff_write('filename', '../MS Frontal hemisphere.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Upper hemisphere.daff', ...
daffv15_write('filename', '../MS Upper hemisphere.daff', ...
'content', 'ms', ...
'datafunc', @dfUpperHemisphereMS, ...
'channels', channels, ...
......@@ -49,7 +49,7 @@ daff_write('filename', '../MS Upper hemisphere.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Omnidirectional.daff', ...
daffv15_write('filename', '../MS Omnidirectional.daff', ...
'content', 'ms', ...
'datafunc', @dfOmnidirectionalMS, ...
'channels', channels, ...
......@@ -57,7 +57,7 @@ daff_write('filename', '../MS Omnidirectional.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Dipole.daff', ...
daffv15_write('filename', '../MS Dipole.daff', ...
'content', 'ms', ...
'datafunc', @dfDipoleMS, ...
'channels', channels, ...
......@@ -65,7 +65,7 @@ daff_write('filename', '../MS Dipole.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Quadrupole.daff', ...
daffv15_write('filename', '../MS Quadrupole.daff', ...
'content', 'ms', ...
'datafunc', @dfQuadrupoleMS, ...
'channels', channels, ...
......@@ -73,7 +73,7 @@ daff_write('filename', '../MS Quadrupole.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Star.daff', ...
daffv15_write('filename', '../MS Star.daff', ...
'content', 'ms', ...
'datafunc', @dfStarMS, ...
'channels', channels, ...
......@@ -81,7 +81,7 @@ daff_write('filename', '../MS Star.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Disc.daff', ...
daffv15_write('filename', '../MS Disc.daff', ...
'content', 'ms', ...
'datafunc', @dfDiscMS, ...
'channels', channels, ...
......@@ -89,7 +89,7 @@ daff_write('filename', '../MS Disc.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Cube.daff', ...
daffv15_write('filename', '../MS Cube.daff', ...
'content', 'ms', ...
'datafunc', @dfCubeMS, ...
'channels', channels, ...
......@@ -97,7 +97,7 @@ daff_write('filename', '../MS Cube.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Bulb.daff', ...
daffv15_write('filename', '../MS Bulb.daff', ...
'content', 'ms', ...
'datafunc', @dfBulbMS, ...
'channels', channels, ...
......@@ -105,7 +105,7 @@ daff_write('filename', '../MS Bulb.daff', ...
'betares', beta_res, ...
'orient', orient);
daff_write('filename', '../MS Thin Belt.daff', ...
daffv15_write('filename', '../MS Thin Belt.daff', ...
'content', 'ms', ...
'datafunc', @dfOmnidirectionalMS, ...
'channels', channels, ...
......
......@@ -46,23 +46,18 @@ if ~signalfound
end
%% Get root of RWTH-ITA-Toolbox
tb_setup_path = which( 'ita_toolbox_setup.m' );
tb_base_path = fileparts( tb_setup_path );
% Switch to user pathdef instead of system-wide pathdef
% (which might open admin permissions dialog and corrupt Matlab for other users)
pathdef_user_path = fullfile( userpath(), 'pathdef.m' );
savepath( pathdef_user_path )
addpath( tb_base_path ); % ... now adds toolbox path to user pathdef.m
tb_setup_path = which('ita_toolbox_setup.m');
tb_base_path = fileparts(tb_setup_path);
%% Add path to kernel, so basic functions are available
addpath([tb_base_path filesep 'kernel']);
addpath(tb_base_path);
addpath([tb_base_path, filesep, 'kernel']);
%% Add userpath, here might be our pathdef.m
addpath(userpath);
%% ITA-Toolbox path handling
% this function has to be in the kernel directory!!!
% this function has to be in the kernel directory!
ita_path_handling();
%% License and Key?
......
......@@ -27,9 +27,6 @@ if exist('KNNSearch','file') == 3 && ~isempty(this.mPtrtree) % Only if external
[ind,dist] = KNNSearch(this.cart,coords.cart,this.mPtrtree,num);
else
%% Old one, using Matlab code
if ita_preferences('verboseMode') && size(this.cart,1) > 10
disp('findnearest@itaCoordinates: You can speed this up by calling ''build_search_database'' prior to the search')
end
for idinput = 1:size(coords.cart,1)
dists = sqrt(sum((this.cart-repmat(coords.cart(idinput,:),size(this.cart,1),1)).^2,2));
for idx = 1:num
......
function returnCoords = mrdivide(position,orientation)
if ~isa(orientation,'itaOrientation')
error('Only multiplication with itaOrientation object is supported')
end
if orientation.nPoints > 1
if orientation.nPoints ~= position.nPoints
error('Number of points and orientations does not fit.');
end
end
if strcmp(orientation.coordSystem,'openGLrh')
position.cart = ita_matlab2openGL(position.cart);
end
if orientation.nPoints > 1
for index = 1:position.nPoints
tmp(index,:) = (orientation.n(index).quat.inverse.RotationMatrix*position.n(index).cart.').';
end
else
tmp = (orientation.quat.inverse.RotationMatrix*position.cart.').';
end
returnCoords = position;
if strcmp(orientation.coordSystem,'openGLrh')
returnCoords.cart = ita_openGL2Matlab(tmp);
else
returnCoords.cart = tmp;
end
\ No newline at end of file
function [ returnCoords ] = mtimes(position,b)
%TIMES Summary of this function goes here
% Detailed explanation goes here
if ~isa(b,'itaOrientation')
error('Only multiplication with itaOrientation object is supported')
end
if b.nPoints > 1
if b.nPoints ~= position.nPoints
error('Number of points and orientations does not fit.');
end
end
if strcmp(b.coordSystem,'openGLrh')
position.cart = ita_matlab2openGL(position.cart);
end
if b.nPoints > 1
for index = 1:position.nPoints
tmp(index,:) = (b.n(index).quat.RotationMatrix*position.n(index).cart.').';
end
else
tmp = (b.quat.RotationMatrix*position.cart.').';
end
returnCoords = position;
if strcmp(b.coordSystem,'openGLrh')
returnCoords.cart = ita_openGL2Matlab(tmp);
else
returnCoords.cart = tmp;
end
end
% if exist('ccx','file')
% ccx
% thisFuncStr = [upper(mfilename) ': ']; %#ok<NASGU> Use to show warnings or infos in this functions
% cprintf('blue',[thisFuncStr 'ccx.m clears all and sets warning messages. \n'])
% end
function result = uminus(a)
% <ITA-Toolbox>
% This file is part of the ITA-Toolbox. Some rights reserved.
......@@ -10,6 +6,6 @@
% </ITA-Toolbox>
% Set path
disp('Loading ita_toolbox_path from local pathdef.')
path(pathdef());
result = a;
result.cart = -a.cart;
end
......@@ -121,6 +121,10 @@ for iChannel = 1:input.nChannels
y = imag(Y(ind-n:ind+n));
p = polyfit((-n:n)',y,N);
r = roots(p);
r = r(abs(r) == min(abs(r)));
sampleStart(iChannel) = ind + r - input.nSamples;
if all(isreal(r))
r = r(abs(r) == min(abs(r)));
sampleStart(iChannel) = ind + r - input.nSamples;
else
sampleStart(iChannel) = 0;
end
end
\ No newline at end of file
......@@ -174,7 +174,12 @@ if sArgs.linfreq %pdi: linear frequency plotting
else
set(sArgs.axes_handle,'XScale','log');
end
axh = get(fgh,'CurrentAxes');
if isempty(sArgs.axes_handle)
axh = get(fgh,'CurrentAxes');
else
axh = sArgs.axes_handle;
end
setappdata(axh,'ChannelHandles',lnh);
%% call help function
......
......@@ -47,23 +47,17 @@ if ~isempty(outpathList)
end
%% Save the path list if possible
ita_verbose_info('ita_path_handling::Saving Path List...',1);
save_state = savepath;
if save_state == 1
disp('Oh Lord. I cannot save the path list for you. Saving pathdef to your home folder');
if isempty( evalin('base','userpath'))
userpath('reset');
end
userfolder = evalin('base','userpath');
if strcmp(userfolder(end),pathsep)
userfolder = userfolder(1:end-1);
end
savepath(fullfile(userfolder,'pathdef.m'));
try
copyfile(fullfile(fullpath,'kernel','StandardRoutines','ita_startup.m'), fullfile(userfolder,'startup.m'))
catch theError
ita_verbose_info('ita_path_handling:writing pathdef unsuccessful, because:',0);
disp(theError.message);
ita_verbose_info('ita_path_handling::Saving path list to your users pathdef.m...',1);
upath = userpath();
if isempty(upath)
userpath('reset');
end
if isempty(userpath())
ita_verbose_info('Oh Lord! I cannot set your userpath. Please check if the default directory exists or manually try saving your path variable.', 0);
else
save_state = savepath(fullfile(upath, 'pathdef.m'));
if save_state == 1
ita_verbose_info('Oh Lord! I could not write to your users pathdef.m', 0);
end
end
......
%% Lambda Resonator Demo Function (see input arguments)
function [ frames ] = ita_demo_lambdaResonator( varargin )
%ita_demo_LAMBDARESONATOR - +++ Short Description here +++
% This function ++++ FILL IN INFO HERE +++
%
% Syntax:
% audioObjOut = ita_demo_lambdaResonator(options)
%
% Options (default):
% 'frequency' (88) : the wave frequency
% 'frequency' (100) : the wave frequency
% 'numReflections' (3) : number of reflections
% 'R' (0.9) : R
% 'resonatorType' (2) : 2 lambda/2 4 lambda/4
% 'maxXFactor' (4) : length of the plot
% 'plotSum' (true) : plot the sum of the waves
% 'plotWavelength' (3) : length of animation
% 'makeMovie' (false) : return frames
......@@ -33,14 +34,16 @@ function [ frames ] = ita_demo_lambdaResonator( varargin )
% Author: Jan Gerrit Richter -- Email: jan.richter@rwth-aachen.de
% Created: 09-Apr-2015
sInit.frequency = 88;
sInit.frequency = 100;
sInit.numReflections = 3;
sInit.R = 0.9;
sInit.makeMovie = 'false';
sInit.frameRate = 10;
sInit.plotSum = 'true';
sInit.plotWavelength = 3;
sArgs = struct('frequency',sInit.frequency,'numReflections',sInit.numReflections,'R',sInit.R,'makeMovie',sInit.makeMovie,'frameRate',sInit.frameRate,'plotSum',sInit.plotSum,'plotWavelength',sInit.plotWavelength);
sInit.resonatorType = 4;
sInit.maxXFactor = 4;
sArgs = struct('frequency',sInit.frequency,'numReflections',sInit.numReflections,'R',sInit.R,'makeMovie',sInit.makeMovie,'frameRate',sInit.frameRate,'plotSum',sInit.plotSum,'plotWavelength',sInit.plotWavelength,'resonatorType',sInit.resonatorType,'maxXFactor',sInit.maxXFactor);
[sArgs] = ita_parse_arguments(sArgs,varargin);
p_hat = 1;
......@@ -59,7 +62,15 @@ function [ frames ] = ita_demo_lambdaResonator( varargin )
lambda100 = c/100;
% x axis from 0 to 2 lambda of 100 Hz
x = 0:0.01:2*lambda100;
if sArgs.resonatorType == 4
maxX = lambda100/4;
maxX = maxX*sArgs.maxXFactor;