Signal and Systems Matlab GUI based analysis
Description: This Signal and Systems based Project takes a sound file in.wav format and performed a detailed analysis, as well as filtering of the signal. The project is programmed in matlab and provides and easy to use GUI interface and provides user to perform various functionalities. Programming: function varargout = pro_sns_p2(varargin) % PRO_SNS_P2 M-file for pro_sns_p2.fig % PRO_SNS_P2, by itself, creates a new PRO_SNS_P2 or raises the existing % singleton*. % % H = PRO_SNS_P2 returns the handle to a new PRO_SNS_P2 or the handle to % the existing singleton*. % % PRO_SNS_P2('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in PRO_SNS_P2.M with the given input arguments. % % PRO_SNS_P2('Property','Value',...) creates a new PRO_SNS_P2 or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before pro_sns_p2_openingfcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to pro_sns_p2_openingfcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help pro_sns_p2 % Last Modified by GUIDE v2.5 04-May-2011 01:44:27 % Begin initialization code - DO NOT EDIT gui_singleton = 1; gui_state = struct('gui_name', mfilename,... 'gui_singleton', gui_singleton,... 'gui_openingfcn', @pro_sns_p2_openingfcn,... 'gui_outputfcn', @pro_sns_p2_outputfcn,... 'gui_layoutfcn', [],... 'gui_callback', []); if nargin && ischar(varargin{1}) gui_state.gui_callback = str2func(varargin{1}); if nargout [varargout{1:nargout}] = gui_mainfcn(gui_state, varargin{:}); gui_mainfcn(gui_state, varargin{:}); % End initialization code - DO NOT EDIT
% --- Executes just before pro_sns_p2 is made visible. function pro_sns_p2_openingfcn(hobject, eventdata, handles, varargin) % This function has no output args, see OutputFcn. % hobject handle to figure % varargin command line arguments to pro_sns_p2 (see VARARGIN) % Choose default command line output for pro_sns_p2 clc; handles.output = hobject; [handles.osig,handles.fs]=wavread('sampledata.wav'); handles.noofbits=5; handles.td1=1; handles.fd1=0; handles.td2=0; handles.fd2=1; handles.controlvol=.5; handles.maximumosig=max(abs(handles.osig)); handles.selectsig1=1; handles.selectsig2=1; handles.soundplay=1; set(handles.radiotime1,'value',handles.td1); set(handles.radiofrequency1,'value',handles.fd1); set(handles.radiotime2,'value',handles.td2); set(handles.radiofrequency2,'value',handles.fd2); set(handles.slidercvolume,'value',handles.controlvol); handles.t=0:1/handles.fs:(length(handles.osig)/handles.fs)-1/handles.fs; ; plot(handles.t,handles.osig) handles.osig=fftshift(fft(handles.osig)/length(handles.osig)); handles.x_axis=-length(handles.osig)/2:1:length(handles.osig)/2-1; ; plot(handles.x_axis,abs(handles.osig)); % Update handles structure % UIWAIT makes pro_sns_p2 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = pro_sns_p2_outputfcn(hobject, eventdata, handles) % varargout cell array for returning output args (see VARARGOUT); % hobject handle to figure % Get default command line output from handles structure varargout{1} = handles.output;
% --- Executes on button press in radiotime1. function radiotime1_callback(hobject, eventdata, handles) % hobject handle to radiotime1 (see GCBO) % Hint: get(hobject,'value') returns toggle state of radiotime1 handles.td1=1; handles.fd1=0; if handles.selectsig1==1 plot(handles.t,handles.osig) if handles.selectsig1==2 ; plot(handles.t,quarantized); if handles.selectsig1==3 % quaran2osig=handles.maximumosig*((2*dig2quaran/handles.noofbits)- 1); ; plot(handles.t,quaran2osig); if handles.selectsig1==4 ; if handles.selectsig1==5 ; set(handles.radiotime1,'value',handles.td1) set(handles.radiofrequency1,'value',handles.fd1)
% --- Executes on button press in radiofrequency1. function radiofrequency1_callback(hobject, eventdata, handles) % hobject handle to radiofrequency1 (see GCBO) % Hint: get(hobject,'value') returns toggle state of radiofrequency1 handles.td1=0; handles.fd1=1; if handles.selectsig1==1 ; plot(handles.x_axis,abs(handles.osig)); if handles.selectsig1==2 FQO=fftshift(fft(quarantized)/length(quarantized)); if handles.selectsig1==3 % quaran2osig=handles.maximumosig*((2*dig2quaran/handles.noofbits)- 1); FQO=fftshift(fft(quaran2osig)/length(quaran2osig)); if handles.selectsig1==4 if handles.selectsig1==5
set(handles.radiotime1,'value',handles.td1); set(handles.radiofrequency1,'value',handles.fd1); % --- Executes on button press in radiotime2. function radiotime2_callback(hobject, eventdata, handles) % hobject handle to radiotime2 (see GCBO) % Hint: get(hobject,'value') returns toggle state of radiotime2 handles.td2=1; handles.fd2=0; if handles.selectsig2==1 plot(handles.t,handles.osig) if handles.selectsig2==2 ; plot(handles.t,quarantized); if handles.selectsig2==3 ; plot(handles.t,quaran2osig); if handles.selectsig2==4 ; if handles.selectsig2==5 ; set(handles.radiotime2,'value',handles.td2) set(handles.radiofrequency2,'value',handles.fd2)
% --- Executes on button press in radiofrequency2. function radiofrequency2_callback(hobject, eventdata, handles) % hobject handle to radiofrequency2 (see GCBO) % Hint: get(hobject,'value') returns toggle state of radiofrequency2 handles.td2=0; handles.fd2=1; if handles.selectsig2==1 ; plot(handles.x_axis,abs(handles.osig)); if handles.selectsig2==2 FQO=fftshift(fft(quarantized)/length(quarantized)); if handles.selectsig2==3 FQO=fftshift(fft(quaran2osig)/length(quaran2osig)); if handles.selectsig2==4 if handles.selectsig2==5
set(handles.radiotime2,'value',handles.td2); set(handles.radiofrequency2,'value',handles.fd2); % --- Executes on selection change in popupaxes1. function popupaxes1_callback(hobject, eventdata, handles) % hobject handle to popupaxes1 (see GCBO) handles.selectsig1=get(hobject,'value'); % Hints: contents = cellstr(get(hobject,'string')) returns popupaxes2 contents as cell array % contents{get(hobject,'value')} returns selected item from popupaxes2 if handles.selectsig1==1 if handles.td1==1 plot(handles.t,handles.osig) plot(handles.x_axis,abs(handles.osig)); if handles.selectsig1==2 if handles.td1==1 ; plot(handles.t,quarantized); FQO=fftshift(fft(quarantized)/length(quarantized)); if handles.selectsig1==3 if handles.td1==1 ; plot(handles.t,quaran2osig); FQO=fftshift(fft(quaran2osig)/length(quaran2osig)); if handles.selectsig1==4
if handles.td1==1 ; if handles.selectsig1==5 if handles.td1==1 ; % --- Executes during object creation, after setting all properties. function popupaxes1_createfcn(hobject, eventdata, handles) % hobject handle to popupaxes1 (see GCBO) % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); % --- Executes on selection change in popupaxes2. function popupaxes2_callback(hobject, eventdata, handles) % hobject handle to popupaxes2 (see GCBO) handles.selectsig2=get(hobject,'value'); % Hints: contents = cellstr(get(hobject,'string')) returns popupaxes2 contents as cell array % contents{get(hobject,'value')} returns selected item from popupaxes2 if handles.selectsig2==1 if handles.td2==1 plot(handles.t,handles.osig) plot(handles.x_axis,abs(handles.osig));
if handles.selectsig2==2 if handles.td2==1 ; plot(handles.t,quarantized); FQO=fftshift(fft(quarantized)/length(quarantized)); if handles.selectsig2==3 if handles.td2==1 ; plot(handles.t,quaran2osig); FQO=fftshift(fft(quaran2osig)/length(quaran2osig)); if handles.selectsig2==4 if handles.td2==1 ; if handles.selectsig2==5 if handles.td2==1 ;
% --- Executes during object creation, after setting all properties. function popupaxes2_createfcn(hobject, eventdata, handles) % hobject handle to popupaxes2 (see GCBO) % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); function bitsnumber_callback(hobject, eventdata, handles) % hobject handle to bitsnumber (see GCBO) % Hints: get(hobject,'string') returns contents of bitsnumber as text % str2double(get(hobject,'string')) returns contents of bitsnumber as a double a=str2double(get(hobject,'string')); handles.noofbits=round(a); set(handles.bitsnumber,'string',handles.noofbits); % --- Executes during object creation, after setting all properties. function bitsnumber_createfcn(hobject, eventdata, handles) % hobject handle to bitsnumber (see GCBO) % handles empty - handles not created until after all CreateFcns called % Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); % --- Executes on selection change in popupsound. function popupsound_callback(hobject, eventdata, handles) % hobject handle to popupsound (see GCBO) % Hints: contents = cellstr(get(hobject,'string')) returns popupsound contents as cell array % contents{get(hobject,'value')} returns selected item from popupsound handles.soundplay=get(hobject,'value'); if handles.soundplay==1
sound(handles.osig*handles.controlvol); axes(handles.axes3) plot(handles.t,handles.osig*handles.controlvol); if handles.soundplay==2 sound(handles.controlvol*quaran2osig); axes(handles.axes3) plot(handles.t,handles.controlvol*quaran2osig); if handles.soundplay==3 sound(handles.controlvol*filtered_osig); axes(handles.axes3) plot(handles.t,handles.controlvol*filtered_osig); if handles.soundplay==4 sound(handles.controlvol*filtered_osig); axes(handles.axes3) plot(handles.t,handles.controlvol*filtered_osig); % --- Executes during object creation, after setting all properties. function popupsound_createfcn(hobject, eventdata, handles) % hobject handle to popupsound (see GCBO) % handles empty - handles not created until after all CreateFcns called % Hint: popupmenu controls usually have a white background on Windows. % See ISPC and COMPUTER. if ispc && isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor','white'); % --- Executes on slider movement. function slidercvolume_callback(hobject, eventdata, handles) % hobject handle to slidercvolume (see GCBO) % Hints: get(hobject,'value') returns position of slider % get(hobject,'min') and get(hobject,'max') to determine range of slider handles.controlvol=get(hobject,'value'); % --- Executes during object creation, after setting all properties.
function slidercvolume_createfcn(hobject, eventdata, handles) % hobject handle to slidercvolume (see GCBO) % handles empty - handles not created until after all CreateFcns called % Hint: slider controls usually have a light gray background. if isequal(get(hobject,'backgroundcolor'), get(0,'defaultuicontrolbackgroundcolor')) set(hobject,'backgroundcolor',[.9.9.9]);