function success_rate = dtmf_attack1(noise_pwr)

%if ~exist('trials','var') | isempty(trials)
    trials = 10;
%end

nums = (1:12)';
orig_sig = dtmf_dial(nums);

success = 0;
displ = 0;

for j = 1:trials
    
    if j == trials
        displ = 1;
    end
    
    disp(['Noise Power: ' num2str(noise_pwr) '  Trial ' num2str(j) '/' num2str(trials)]);
    
    sig = orig_sig + noise_pwr*randn(size(orig_sig));
    
    decoded = dtmf_decode(sig,displ);
    
    if length(decoded) == length(nums) & all(decoded == nums)
        success = success + 1;
        disp('   Decoding successful.');
    else
        disp('   *** Decoder Error ***');
        disp(['     Original: ' num2str(nums')]);
        disp(['     Decoded : ' num2str(decoded')]);
    end
end

%figure(3)
%plot((1:length(sig))/8192,sig);
%xlabel('Time (sec)'); ylabel('Amplitude');

success_rate = success/trials;