📄 zyx6.m
字号:
end% --- Executes on slider movement.function slider6_Callback(hObject, eventdata, handles)% hObject handle to slider6 (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 edit1_CreateFcn(hObject, eventdata, handles)% hObject handle to edit1 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit1_Callback(hObject, eventdata, handles)% hObject handle to edit1 (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 edit1 as text% str2double(get(hObject,'String')) returns contents of edit1 as a double%设置滚动条的数值
val=str2num(get(handles.edit1,'string'))
if isnumeric(val)&length(val)==1&...
val>=get(handles.slider1,'min')&...
val<=get(handles.slider1,'max')
set(handles.slider1,'value',val)
end% --- 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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction 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%设置滚动条的数值
val=str2num(get(handles.edit2,'string'))
if isnumeric(val)&length(val)==1&...
val>=get(handles.slider4,'min')&...
val<=get(handles.slider4,'max')
set(handles.slider4,'value',val)
end% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject handle to edit3 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit3_Callback(hObject, eventdata, handles)% hObject handle to edit3 (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 edit3 as text% str2double(get(hObject,'String')) returns contents of edit3 as a double%设置滚动条的数值
val=str2num(get(handles.edit3,'string'))
if isnumeric(val)&length(val)==1&...
val>=get(handles.slider5,'min')&...
val<=get(handles.slider5,'max')
set(handles.slider5,'value',val)
end% --- Executes during object creation, after setting all properties.function edit4_CreateFcn(hObject, eventdata, handles)% hObject handle to edit4 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit4_Callback(hObject, eventdata, handles)% hObject handle to edit4 (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 edit4 as text% str2double(get(hObject,'String')) returns contents of edit4 as a double%设置滚动条的数值
val=str2num(get(handles.edit4,'string'))
if isnumeric(val)&length(val)==1&...
val>=get(handles.slider6,'min')&...
val<=get(handles.slider6,'max')
set(handles.slider6,'value',val)
end% --- Executes during object creation, after setting all properties.function slider7_CreateFcn(hObject, eventdata, handles)% hObject handle to slider7 (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 slider7_Callback(hObject, eventdata, handles)% hObject handle to slider7 (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.52,0.45,0.4])
plot(x1,y1)
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.12,0.45,0.4])
plot(x2,y2)% --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject handle to edit5 (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 set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction edit5_Callback(hObject, eventdata, handles)% hObject handle to edit5 (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 edit5 as text% str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes on button press in pushbutton1.function pushbutton1_Callback(hObject, eventdata, handles)% hObject handle to pushbutton1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)close% --- Executes on button press in pushbutton2.function pushbutton2_Callback(hObject, eventdata, handles)% hObject handle to pushbutton2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)zyx8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -