📄 page2_1.asv
字号:
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 during object creation, after setting all properties.function edit6_CreateFcn(hObject, eventdata, handles)% hObject handle to edit6 (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 edit6_Callback(hObject, eventdata, handles)% hObject handle to edit6 (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 edit6 as text% str2double(get(hObject,'String')) returns contents of edit6 as a double% --- Executes during object creation, after setting all properties.function edit7_CreateFcn(hObject, eventdata, handles)% hObject handle to edit7 (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 edit7_Callback(hObject, eventdata, handles)% hObject handle to edit7 (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 edit7 as text% str2double(get(hObject,'String')) returns contents of edit7 as a double% --- Executes during object creation, after setting all properties.function edit8_CreateFcn(hObject, eventdata, handles)% hObject handle to edit8 (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 edit8_Callback(hObject, eventdata, handles)% hObject handle to edit8 (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 edit8 as text% str2double(get(hObject,'String')) returns contents of edit8 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)
a1 = str2double(get(handles.edit1,'String'));
f1 = str2double(get(handles.edit2,'String'));
s1 = str2double(get(handles.edit3,'String'));
a2 = str2double(get(handles.edit4,'String'));
f2 = str2double(get(handles.edit5,'String'));
s2 = str2double(get(handles.edit6,'String'));
val1 = get(handles.popupmenu1,'Value');
switch val1
case 1
t = 0:0.01*pi:6*pi;
y1 = a1*sin(f1*t+s1);
case 2
t = 0:0.01*pi:6*pi;
y1 = a1*square(f1*t+s1);
case 3
t = 0:0.01*pi:6*pi;
y1 = a1*sawtooth(f1*t+s1);
case 4
t = [-10:0.01:10];
y1 = a1*[(t-s1) >= 0];
case 5
t = [-10:0.01:10];
y1 = a1*[(t-s1) == 0];
end
val2 = get(handles.popupmenu2,'Value');
switch val2
case 1
t = 0:0.01*pi:6*pi;
y2 = a2*sin(f2*t+s2);
case 2
t = 0:0.01*pi:6*pi;
y2 = a2*square(f2*t+s2);
case 3
t = 0:0.01*pi:6*pi;
y2 = a2*sawtooth(f2*t+s2);
case 4
t = [-10:0.01:10];
y2 = a2*[(t-s2) >= 0];
case 5
t = [-10:0.01:10];
y2 = a2*[(t-s2) == 0];
end
axes(handles.axes1) % Select the proper axes
plot(t,y1,'-r',t,y2,'--b')
set(handles.axes1,'XMinorTick','on')
grid on
y = y1 + y2;
axes(handles.axes2) % Select the proper axes
plot(t,y)
set(handles.axes2,'XMinorTick','on')
grid on
% --- 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)
a1 = str2double(get(handles.edit1,'String'));
f1 = str2double(get(handles.edit2,'String'));
s1 = str2double(get(handles.edit3,'String'));
a2 = str2double(get(handles.edit4,'String'));
f2 = str2double(get(handles.edit5,'String'));
s2 = str2double(get(handles.edit6,'String'));
n1 = str2double(get(handles.edit7,'String'));
n2 = str2double(get(handles.edit8,'String'));
val1 = get(handles.popupmenu1,'Value');
switch val1
case 1
t1 = 0:0.01*pi:6*pi;
y1 = a1*sin(f1*t1+s1);
case 2
t1 = 0:0.01*pi:6*pi;
y1 = a1*square(f1*t1+s1);
case 3
t1 = 0:0.01*pi:6*pi;
y1 = a1*sawtooth(f1*t1+s1);
case 4
t1 = [-10:0.01:10];
y1 = a1*[(t1-s1) >= 0];
case 5
t1 = [-10:0.01:10];
y1 = a1*[(t1-s1) == 0];
otherwise
y1 = 0;
end
val2 = get(handles.popupmenu2,'Value');
switch val2
case 1
t2 = 0:0.01*pi:6*pi;
y2 = a2*sin(f2*t2+s2);
case 2
t2 = 0:0.01*pi:6*pi;
y2 = a2*square(f2*t2+s2);
case 3
t2 = 0:0.01*pi:6*pi;
y2 = a2*sawtooth(f2*t2+s2);
case 4
t2 = [-10:0.01:10];
y2 = a2*[(t2-s2) >= 0];
case 5
t2 = [-10:0.01:10];
y2 = a2*[(t2-s2) == 0];
otherwise
y2 = 0;
end
x3=t1+n1;x4=t2+n2;
axes(handles.axes1) % Select the proper axes
plot(x3,y1,'-r',x4,y2,'--b')
set(handles.axes1,'XMinorTick','on')
grid on
x3=t1+n1;x4=t2+n2;
[y,x]=sigadd(y1,x3,y2,x4);
axes(handles.axes2) % Select the proper axes
plot(x,y)
set(handles.axes2,'XMinorTick','on')
grid on
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
figure(1)
s1_6
grid on
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
close
page2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -