% script file analyze_dir_pattern.m
%
% Analysieren/Plotten von Richtdiagrammen
%
% Copyright (C) 2010 by Matthias Blau
% Author :  Matthias Blau <matthias.blau AT fh-oldenburg.de>
% Date   :  21 Oct 2010
% Updated:  21 Oct 2010
%
% This file is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published
% by the Free Software Foundation; either version 3 of the License, 
% or (at your option) any later version.
% See the GNU General Public License for more details:
% http://www.gnu.org/licenses/gpl
%
%

%----------------------------- Einlesen -----------------------------------
[filename,pathname,filterindex]=uigetfile('*.wav', 'Pick wav-file');
fname=[pathname,filename];   % alternativ kann der Dateiname natürlich manuell
                             % eingegeben werden
data=wavread(fname);

angle=data(:,1);             % 1.Kanal - Winkel
dir_pattern=data(:,2);       % 2.Kanal - normierte Pegel

%----------------------------- Plotten ------------------------------------
% jetzt brauchen wir dirplot, muss in den Suchpfad kopiert sein
path(path,'/home/blau/teaching/grundlagenpraktikum/akustik/msrc/dirplot/');

fh1=figure(1);
angle2=angle; idx=find(angle2>180); angle2(idx)=angle2(idx)-360;
                             % das ist ein Trick, damit dirplot richtig
                             % funktioniert
Dirplot(angle2,dir_pattern-dir_pattern(1),'-',[5 -25 3]);
