📄 zyx6.m
字号:
function varargout = zyx6(varargin)
% ZYX6 M-file for zyx6.fig
% ZYX6, by itself, creates a new ZYX6 or raises the existing
% singleton*.
%
% H = ZYX6 returns the handle to a new ZYX6 or the handle to
% the existing singleton*.
%
% ZYX6('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in ZYX6.M with the given input arguments.
%
% ZYX6('Property','Value',...) creates a new ZYX6 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before zyx6_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to zyx6_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 zyx6
% Last Modified by GUIDE v2.5 10-Jun-2005 06:54:11
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @zyx6_OpeningFcn, ...
'gui_OutputFcn', @zyx6_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 zyx6 is made visible.
function zyx6_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 zyx6 (see VARARGIN)
% Choose default command line output for zyx6
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes zyx6 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = zyx6_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)
%设置当前窗口名
str='频率特性'
set(gcf,'name',str,'numbertitle','off')
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes during object creation, after setting all properties.function slider1_CreateFcn(hObject, eventdata, handles)% hObject handle to slider1 (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 slider1_Callback(hObject, eventdata, handles)% hObject handle to slider1 (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
%从编辑框中获得滑块的值set(handles.edit1,'String',...
num2str(get(handles.slider1,'Value')));
set(handles.edit2,'String',...
num2str(get(handles.slider4,'Value')));
set(handles.edit3,'String',...
num2str(get(handles.slider5,'Value')));
set(handles.edit4,'String',...
num2str(get(handles.slider6,'Value')));
k=get(handles.slider1,'value')
T=get(handles.slider4,'value')
Xi=get(handles.slider5,'value')
w=get(handles.slider6,'value')
%绘制输入曲线
t=-4:0.1:4
x1=w*t
y1=Xi*sin(x1)
subplot('position',[0.53,0.54,0.45,0.4])
plot(x1,y1)
title(' 输入曲线')
grid on
hold
%求频率特性
num=[1]
den=[T 1]
Gm=polyval(num,j*w)./polyval(den,j*w)
Aw=abs(Gm)
Fw=angle(Gm)
%画频率响应曲线
Xo=Aw*Xi*k
x2=(x1+Fw)
y2=Xo*sin(x2)
subplot('position',[0.53,0.05,0.45,0.4])
plot(x2,y2)
title(' 频率 响应')
grid on% --- Executes during object creation, after setting all properties.function slider4_CreateFcn(hObject, eventdata, handles)% hObject handle to slider4 (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 slider4_Callback(hObject, eventdata, handles)% hObject handle to slider4 (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
%从编辑框中获得滑块的值set(handles.edit1,'String',...
num2str(get(handles.slider1,'Value')));
set(handles.edit2,'String',...
num2str(get(handles.slider4,'Value')));
set(handles.edit3,'String',...
num2str(get(handles.slider5,'Value')));
set(handles.edit4,'String',...
num2str(get(handles.slider6,'Value')));
k=get(handles.slider1,'value')
T=get(handles.slider4,'value')
Xi=get(handles.slider5,'value')
w=get(handles.slider6,'value')
%绘制输入曲线
t=-4:0.1:4
x1=w*t
y1=Xi*sin(x1)
subplot('position',[0.53,0.54,0.45,0.4])
plot(x1,y1)
title(' 输入曲线')
grid on
hold
%求频率特性
num=[1]
den=[T 1]
Gm=polyval(num,j*w)./polyval(den,j*w)
Aw=abs(Gm)
Fw=angle(Gm)
%绘制频率响应曲线
Xo=Aw*Xi*k
x2=(x1+Fw)
y2=Xo*sin(x2)
subplot('position',[0.53,0.05,0.45,0.4])
plot(x2,y2)
title('频率响应')
grid on% --- Executes during object creation, after setting all properties.function slider5_CreateFcn(hObject, eventdata, handles)% hObject handle to slider5 (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 slider5_Callback(hObject, eventdata, handles)% hObject handle to slider5 (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%从编辑框中获得滑块的值set(handles.edit1,'String',...
num2str(get(handles.slider1,'Value')));
set(handles.edit2,'String',...
num2str(get(handles.slider4,'Value')));
set(handles.edit3,'String',...
num2str(get(handles.slider5,'Value')));
set(handles.edit4,'String',...
num2str(get(handles.slider6,'Value')));
k=get(handles.slider1,'value')
T=get(handles.slider4,'value')
Xi=get(handles.slider5,'value')
w=get(handles.slider6,'value')
%绘制输入曲线
t=-4:0.1:4
x1=w*t
y1=Xi*sin(x1)
subplot('position',[0.53,0.54,0.45,0.4])
plot(x1,y1)
title(' 输入曲线')
grid on
hold
%求频率特性
num=[1]
den=[T 1]
Gm=polyval(num,j*w)./polyval(den,j*w)
Aw=abs(Gm)
Fw=angle(Gm)
%绘制频率响应曲线
Xo=Aw*Xi*k
x2=(x1+Fw)
y2=Xo*sin(x2)
subplot('position',[0.53,0.05,0.45,0.4])
plot(x2,y2)
title(' 频率响应')
grid on% --- Executes during object creation, after setting all properties.function slider6_CreateFcn(hObject, eventdata, handles)% hObject handle to slider6 (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'));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -