% SIGNAL_IN.M
% Read a signal file into Matlab
% It may be necessary to tailor this code to the user's audio file format.
In particular, this code assumes:
% - 16 bit samples ('short')
Header_size = 1000;
file_in = input('Please enter the name of the input signal file: ','s');
fid_in = fopen(file_in,'r');
In = fread(fid_in,Inf,'short');
Size = length(In);
plot(In(Header_size:Size))
title('Input signal (In)')
% RMS.M
% Assumes you have used signal_in.m to read the contents of an audio
file into In. Calculates and prints out the root mean square
amplitude of
the signal In.
rms = sqrt(sum(In.^2)/length(In))