function commbluetoothfduplex_init
%

% Copyright 2006-2012 The MathWorks, Inc.
  
% Initialize variables for Bluetooth Full Duplex Voice and Data Transmission Model

% Input wave sample rate must be 8kHz
%Input_Fs=8000;

load commbluetoothfduplex_codedata; %#ok<LOAD>

% Coefficients for speech interpolation
[y,interp_coeffs]=interp(ones(1,10),8); clear y; %#ok<*ASGLU>

% 1,0,1,0, sequence
One_Zero_Payload=zeros(240,1);
One_Zero_Payload(1:2:240)=1; %#ok<*NASGU>

% Seeds
hop_seed          = 100693;
awgn_channel_seed = 45233;
awgn_802_seed     = 14639;
rate_802_seed     = 47977;
data_seed         = 78259;

% Hop frequency if fixed
fixed_hop_freq=20;

%Misc
Num_Payload_Bits=80;

% Initial noise variance

%var=0;
EsNo=18;

% Set input wave sample rate to be 8kHz
voice_input1 = audioread('commbluetoothfduplex_input1.wav');
voice_input2 = audioread('commbluetoothfduplex_input2.wav');

% Variables to assign to structure in base workspace.
params = ...
    {'interp_coeffs'
    'One_Zero_Payload'
    'hop_seed'
    'awgn_channel_seed'
    'awgn_802_seed'
    'rate_802_seed'
    'data_seed'
    'fixed_hop_freq'
    'Num_Payload_Bits'
    'EsNo'
     'G'
     'H'
     'k'
     'n'
     'trt'
     'voice_input1'
     'voice_input2'};

% Assign parameter structure to base workspace.
assignin('base', 'bluetooth_fd', makestruct(params{:}));

 

%--------------------------------------------------------------------------
function s = makestruct(varargin)
for n = 1:length(varargin)
    name = varargin{n};
    s.(name) = evalin('caller', name);
end
