📄 spectrumexpo.m
字号:
% --- Executes on slider movement.function freq2slider_Callback(hObject, eventdata, handles) freq2 = num2str(2^get(hObject,'Value')); set(handles.freq2,'String',freq2); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function amp2slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function amp2slider_Callback(hObject, eventdata, handles) amp2 = num2str(get(hObject,'Value')); set(handles.amp2,'String',amp2); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function phase2slider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function phase2slider_Callback(hObject, eventdata, handles) phase2 = num2str(get(hObject,'Value')); set(handles.phase2,'String',phase2); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function offset_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction offset_Callback(hObject, eventdata, handles) offset = str2double(get(hObject,'String')); if offset < 0 offset = 0; elseif offset > 1 offset = 1; end set(handles.offset,'String',num2str(offset)); set(handles.offsetslider,'Value',offset); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function offsetslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function offsetslider_Callback(hObject, eventdata, handles) offset = num2str(get(hObject,'Value')); set(handles.offset,'String',offset); spectrumexpofn 'update';%% --- Executes on button press in updatebutton.%function updatebutton_Callback(hObject, eventdata, handles)% update_Callback(hObject, eventdata, handles)% --- Executes on button press in play.function play_Callback(hObject, eventdata, handles) spectrumexpofn 'play';% --- Executes during object creation, after setting all properties.function plotype_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on selection change in plotype.function plotype_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function Fstext_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction Fstext_Callback(hObject, eventdata, handles) Fs = str2double(get(hObject,'String')); if (Fs > 44100) Fs = 44100; end if (Fs < 21) Fs = 21; end set(handles.Fsslider,'Value',log2(Fs)); set(handles.Fstext,'String',num2str(Fs)); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function Fsslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function Fsslider_Callback(hObject, eventdata, handles) Fs = ceil(2^get(hObject,'Value')); if (Fs > 44100) Fs = 44100; end if (Fs < 0) Fs = 0; end set(handles.Fsslider,'Value',log2(Fs)); set(handles.Fstext,'String',num2str(Fs)); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function durationtext_CreateFcn(hObject, eventdata, handles)if ispc set(hObject,'BackgroundColor','white');else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));endfunction durationtext_Callback(hObject, eventdata, handles) duration = str2double(get(hObject,'String')); if duration <= 0 duration = 0.01; set(handles.durationtext,'String',num2str(duration)); end set(handles.durationslider,'Value',duration); spectrumexpofn 'update';% --- Executes during object creation, after setting all properties.function durationslider_CreateFcn(hObject, eventdata, handles)usewhitebg = 1;if usewhitebg set(hObject,'BackgroundColor',[.9 .9 .9]);else set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end% --- Executes on slider movement.function durationslider_Callback(hObject, eventdata, handles) duration = num2str(get(hObject,'Value')); set(handles.durationtext,'String',duration); spectrumexpofn 'update';% --- Executes on button press in gridbox.function gridbox_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes on button press in plot1box.function plot1box_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes on button press in plot2box.function plot2box_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes on button press in spectrumbutton.function spectrumbutton_Callback(hObject, eventdata, handles) spectrumexpofn 'spectrum';% --- Executes on button press in interpbox.function interpbox_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes on button press in samplebox.function samplebox_Callback(hObject, eventdata, handles) spectrumexpofn 'update';% --- Executes when user attempts to close spectrumexpo_fig.function spectrumexpo_fig_CloseRequestFcn(hObject, eventdata, handles)% hObject handle to spectrumexpo_fig (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% Hint: delete(hObject) closes the figuredelete(hObject);% --------------------------------------------------------------------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 fourier_Callback(hObject, eventdata, handles)% hObject handle to fourier (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) spectrumexpofn 'fourier';% --------------------------------------------------------------------function sonogram_Callback(hObject, eventdata, handles)% hObject handle to Untitled_3 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) spectrumexpofn 'sonogram';% --------------------------------------------------------------------function alias_Callback(hObject, eventdata, handles)% hObject handle to Untitled_2 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA) spectrumexpofn 'alias';% --------------------------------------------------------------------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) spectrumexpofn 'help';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -