⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scoredemo.asv

📁 很多matlab的源代码
💻 ASV
字号:
function varargout = scoredemo(varargin)
% SCOREDEMO M-file for scoredemo.fig
%      SCOREDEMO, by itself, creates a new SCOREDEMO or raises the existing
%      singleton*.
%
%      H = SCOREDEMO returns the handle to a new SCOREDEMO or the handle to
%      the existing singleton*.
%
%      SCOREDEMO('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in SCOREDEMO.M with the given input arguments.
%
%      SCOREDEMO('Property','Value',...) creates a new SCOREDEMO or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before scoredemo_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to scoredemo_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 scoredemo

% Last Modified by GUIDE v2.5 24-May-2004 20:33:12
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @scoredemo_OpeningFcn, ...
                   'gui_OutputFcn',  @scoredemo_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 scoredemo is made visible.
function scoredemo_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 scoredemo (see VARARGIN)

% Choose default command line output for scoredemo
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes scoredemo wait for user response (see UIRESUME)
% uiwait(handles.figure1);
axes(handles.axes1);
    score=importdata('score.txt','\t');
    x=score.data;
    plot(x);

% --- Outputs from this function are returned to the command line.
function varargout = scoredemo_OutputFcn(hObject, eventdata, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in info.function info_Callback(hObject, eventdata, handles)% hObject    handle to info (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --- Executes on button press in close.function close_Callback(hObject, eventdata, handles)% hObject    handle to close (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)close;% --- Executes during object creation, after setting all properties.function order_CreateFcn(hObject, eventdata, handles)% hObject    handle to order (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, change%       'usewhitebg' to 0 to use default.  See ISPC and COMPUTER.usewhitebg = 1;if usewhitebg    set(hObject,'BackgroundColor',[.9 .9 .9]);else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function order_Callback(hObject, eventdata, handles)% hObject    handle to order (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 sliderflag=get(handles.file,'value')
axes(handles.axes1);
if flag==1
    score=importdata('score.txt','\t');
    x=score.data;
    plot(x);
else 
    score=importdata('t3.txt','\t');
    x=score(:,2);
    nn=score(:,1);
    plot(nn,x);
end
Title('The Original Score of Student');
num=floor(get(handles.order,'value'))
h=ones(1,num)/num;
y=conv(h,x);
axes(handles.axes2);
if flag==1
    nn=0:length(y)-1;
else
    nn=(0:length(y)-1)/length(y)*100;
end
plot(nn,y);
Title('The Filtered data');

axes(handles.axes3);
nn=0:num-1;
stem(nn,h);
Title('The Impulse Response of The Filter');
axes(handles.axes4);
H=fft(h,1024);
H1=H(1:512);
f=(0:511)/512*pi;
plot(f,abs(H1));
Title('The Frequency Response of The Filter');% --- Executes during object creation, after setting all properties.function file_CreateFcn(hObject, eventdata, handles)% hObject    handle to file (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    set(hObject,'BackgroundColor','white');else    set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in file.function file_Callback(hObject, eventdata, handles)% hObject    handle to file (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 file contents as cell array%        contents{get(hObject,'Value')} returns selected item from filescoredemo('file_Callback',gcbo,[],guidata(gcbo))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -