www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/physmodel/string/stringexpo.m

    function varargout = stringexpo(varargin)
% STRINGEXPO M-file for stringexpo.fig
%      STRINGEXPO, by itself, creates a new STRINGEXPO or raises the existing
%      singleton*.
%
%      H = STRINGEXPO returns the handle to a new STRINGEXPO or the handle to
%      the existing singleton*.
%
%      STRINGEXPO('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in STRINGEXPO.M with the given input arguments.
%
%      STRINGEXPO('Property','Value',...) creates a new STRINGEXPO or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before stringexpo_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to stringexpo_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 stringexpo

% Last Modified by GUIDE v2.5 25-Feb-2005 22:55:33

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @stringexpo_OpeningFcn, ...
                   'gui_OutputFcn',  @stringexpo_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin & isstr(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end

% End initialization code - DO NOT EDIT

% --- Executes just before stringexpo is made visible.
function stringexpo_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to stringexpo (see VARARGIN)

% Choose default command line output for stringexpo
	handles.output = hObject;
	guidata(hObject, handles);
	set(gcf,'UserData',handles);
	stringexpofn;

    
	if (nargin > 3)
		datastruct = varargin{1};
		stringexpofn('readinput',datastruct);
	end

% --- Outputs from this function are returned to the command line.
function varargout = stringexpo_OutputFcn(hObject, eventdata, handles)
	varargout{1} = handles.output;

% --------------------------------------------------------------------
function FileMenu_Callback(hObject, eventdata, handles)

% --------------------------------------------------------------------
function PrintMenuItem_Callback(hObject, eventdata, handles)
	stringexpofn 'print';

% --------------------------------------------------------------------
function CloseMenuItem_Callback(hObject, eventdata, handles)
	stringexpofn 'close';

% --- Executes on button press in print.
function print_Callback(hObject, eventdata, handles)
	stringexpofn 'print';


% --------------------------------------------------------------------
function Untitled_1_Callback(hObject, eventdata, handles)
% hObject    handle to Untitled_1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA


% --------------------------------------------------------------------
function alias_Callback(hObject, eventdata, handles)
% hObject    handle to alias (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    stringexpofn 'alias';


% ----------9----------------------------------------------------------
function help_Callback(hObject, eventdata, handles)
% hObject    handle to help (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    stringexpofn 'help';


% --- Executes when stringexpo_fig window is resized.
function stringexpo_fig_ResizeFcn(hObject, eventdata, handles)
% hObject    handle to stringexpo_fig (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    stringexpofn 'resize';


% --- Executes on slider movement.
function excite_position_Callback(hObject, eventdata, handles)
% hObject    handle to excite_position (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
	val = get(hObject,'Value');
	set(handles.excite_position_text,'String',num2str(val));
    stringexpofn 'excitetype';

% --- Executes during object creation, after setting all properties.
function excite_position_CreateFcn(hObject, eventdata, handles)
% hObject    handle to excite_position (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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]);
end


% --- Executes on button press in play.
function play_Callback(hObject, eventdata, handles)
% hObject    handle to play (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
	stringexpofn 'play';


% --- Executes on slider movement.
function excite_amplitude_slider_Callback(hObject, eventdata, handles)
% hObject    handle to excite_amplitude_slider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'Value') returns position of slider
%        get(hObject,'Min') and get(hObject,'Max') to determine range of slider
    stringexpofn 'excitetype';

% --- Executes during object creation, after setting all properties.
function excite_amplitude_slider_CreateFcn(hObject, eventdata, handles)
% hObject    handle to excite_amplitude_slider (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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]);
end


% --- Executes on selection change in excite_menu.
function excite_menu_Callback(hObject, eventdata, handles)
% hObject    handle to excite_menu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns excite_menu contents as cell array
%        contents{get(hObject,'Value')} returns selected item from excite_menu
    stringexpofn 'excitetype';

% --- Executes during object creation, after setting all properties.
function excite_menu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to excite_menu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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');
end



function edit2_Callback(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit2 as text
%        str2double(get(hObject,'String')) returns contents of edit2 as a double


% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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');
end



function timestep_Callback(hObject, eventdata, handles)
% hObject    handle to timestep (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of timestep as text
%        str2double(get(hObject,'String')) returns contents of timestep as a double
    val = str2num(get(hObject,'String'));
	if (val < 10)
		val = 10;
    end
    val = round(val);
	set(hObject,'String',num2str(val));

% --- Executes during object creation, after setting all properties.
function timestep_CreateFcn(hObject, eventdata, handles)
% hObject    handle to timestep (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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');
end


% --- Executes on selection change in model_menu.
function model_menu_Callback(hObject, eventdata, handles)
% hObject    handle to model_menu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = get(hObject,'String') returns model_menu contents as cell array
%        contents{get(hObject,'Value')} returns selected item from model_menu
    contents = get(hObject,'String');
    switch contents{get(hObject,'Value')}
        case {'Ideal','Loss(f)'}
            set(handles.loss,'Enable','inactive');
        case 'Lossy'
            set(handles.loss,'Enable','on');
    end

% --- Executes during object creation, after setting all properties.
function model_menu_CreateFcn(hObject, eventdata, handles)
% hObject    handle to model_menu (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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');
end



function loss_Callback(hObject, eventdata, handles)
% hObject    handle to loss (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of loss as text
%        str2double(get(hObject,'String')) returns contents of loss as a double
    val = str2num(get(hObject,'String'));
	if (val > 1)
		val = 1;
    elseif (val < 0)
        val = 0;
    end
	set(hObject,'String',num2str(val));

% --- Executes during object creation, after setting all properties.
function loss_CreateFcn(hObject, eventdata, handles)
% hObject    handle to loss (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% 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');
end


% --- Executes on button press in reset.
function reset_Callback(hObject, eventdata, handles)
% hObject    handle to reset (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
    stringexpofn 'reset';