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

📄 fftplatform.asv

📁 FPGA输出数据的时频域分析GUI界面
💻 ASV
📖 第 1 页 / 共 2 页
字号:

% Set the axes control frame
xmin = num2str(-Fs/2);
xmax = num2str(Fs/2);
set(handles.XMin,'String',xmin);
set(handles.XMax,'String',xmax);
ymin = num2str(min(Power));
ymax = num2str(max(Power));
set(handles.YMin,'String',ymin);
set(handles.YMax,'String',ymax);

% Set the Auto State
set(handles.XAuto,'Value',1);
set(handles.YAuto,'Value',1);

set(handles.Plot,'UserData',2);

% Set EnvelopePlot Push Button enable on
set(handles.EnvelopePlot,'Enable','on');



% --- Executes on button press in EnvelopePlot.
function EnvelopePlot_Callback(hObject, eventdata, handles)
% hObject    handle to EnvelopePlot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get the power data
ud = get(handles.FFTPlatForm,'UserData');
Power = ud.PData;
Fs=ud.Fs;

axes(handles.Figure)
N=64;
[Power_wrap t]=my_wrap(Power,Fs*1e3,N);

% Set FFTFPlot UserData the Power data
ud.PData_wrap = Power_wrap;
set(handles.FFTPlatForm,'UserData',ud);

plot(t/1e3,Power_wrap);
grid on
title('FFT Power')
xlabel('f/(kHz)')
ylabel('Magnitude in dBm')
zoom on;grid on;axis tight;hold off;% creat imag plot
set(handles.Notes,'ForegroundColor','black');
handles.str=get(handles.Notes,'String');
str = '->> FFT Power figure envelop ploting has been done.';
handles.str=[handles.str;str];
set(handles.Notes,'String',handles.str);

% Set the axes control frame
xmin = num2str(-Fs/2);
xmax = num2str(Fs/2);
set(handles.XMin,'String',xmin);
set(handles.XMax,'String',xmax);
ymin = num2str(min(Power_wrap));
ymax = num2str(max(Power_wrap));
set(handles.YMin,'String',ymin);
set(handles.YMax,'String',ymax);

% Set the Auto State
set(handles.XAuto,'Value',1);
set(handles.YAuto,'Value',1);

set(handles.Plot,'UserData',3);


function Notes_Callback(hObject, eventdata, handles)
% hObject    handle to Notes (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 Notes as text
%        str2double(get(hObject,'String')) returns contents of Notes as a double


% --- Executes during object creation, after setting all properties.
function Notes_CreateFcn(hObject, eventdata, handles)
% hObject    handle to Notes (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end


% --- Executes on button press in XAuto.
function XAuto_Callback(hObject, eventdata, handles)
% hObject    handle to XAuto (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of XAuto
% 

p=get(handles.Plot,'UserData');

ud = get(handles.FFTPlatForm,'UserData');
TData = ud.FData;
Fs = ud.Fs;
        
if p==1
    val = get(handles.XAuto,'Value');
    if val == 1
        xmin = 0;
        xmax = (length(TData)-1)/Fs;
        set(handles.Plot,'XLim',[xmin xmax]);
        set(handles.XMin,'String',num2str(xmin));
        set(handles.XMax,'String',num2str(xmax));
    else
        XMin_Callback;
        XMax_Callback;
    end
    % Set the Auto Parameter Enable on
    set(handles.XAuto,'Enable','off');
else
    if p==2
       val = get(handles.XAuto,'Value');
       if val == 1
           xmin = -Fs/2;
           xmax = Fs/2;
           set(handles.Plot,'XLim',[xmin xmax]);
           set(handles.XMin,'String',num2str(xmin));
           set(handles.XMax,'String',num2str(xmax));
       else
           XMin_Callback;
           XMax_Callback;
       end
       % Set the Auto Parameter Enable on
       set(handles.XAuto,'Enable','off');
    end
    if p==3
       val = get(handles.XAuto,'Value');
       if val == 1
           xmin = -Fs/2;
           xmax = Fs/2;
           set(handles.Plot,'XLim',[xmin xmax]);
           set(handles.XMin,'String',num2str(xmin));
           set(handles.XMax,'String',num2str(xmax));
       else
           XMin_Callback;
           XMax_Callback;
       end
       % Set the Auto Parameter Enable on
       set(handles.XAuto,'Enable','off');
    end 
end


% Set the Auto Parameter Enable on
set(handles.XAuto,'Enable','off');


function XMin_Callback(hObject, eventdata, handles)
% hObject    handle to XMin (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 XMin as text
%        str2double(get(hObject,'String')) returns contents of XMin as a
%        double

xmin = str2double(get(handles.XMin,'String'));
x = get(handles.Plot,'XLim');
xmax = x(2);
set(handles.Plot,'XLim',[xmin xmax]);
set(handles.XAuto,'Value',0);
% Set the Auto Parameter Enable on
set(handles.XAuto,'Enable','on');


% --- Executes during object creation, after setting all properties.
function XMin_CreateFcn(hObject, eventdata, handles)
% hObject    handle to XMin (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function XMax_Callback(hObject, eventdata, handles)
% hObject    handle to XMax (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 XMax as text
%        str2double(get(hObject,'String')) returns contents of XMax as a double

xmax = str2double(get(handles.XMax,'String'));
x = get(handles.Plot,'XLim');
xmin = x(1);
set(handles.Plot,'XLim',[xmin xmax]);
set(handles.XAuto,'Value',0);
% Set the Auto Parameter Enable on
set(handles.XAuto,'Enable','on');



% --- Executes during object creation, after setting all properties.
function XMax_CreateFcn(hObject, eventdata, handles)
% hObject    handle to XMax (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



% --- Executes on button press in YAuto.
function YAuto_Callback(hObject, eventdata, handles)
% hObject    handle to YAuto (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of YAuto

p=get(handles.Plot,'UserData');

if p==1
    val = get(handles.YAuto,'Value');
    if val == 1
        ud = get(handles.FFTPlatForm,'UserData');
        TData = ud.FData;
        ymin = min(TData);
        ymax = max(TData);
        set(handles.Plot,'YLim',[ymin ymax]);
        set(handles.YMin,'String',num2str(ymin));
        set(handles.YMax,'String',num2str(ymax));
    else
        YMin_Callback;
        YMax_Callback;
    end
    % Set the Auto Parameter Enable on
    set(handles.YAuto,'Enable','off');
else 
    if p==2
        val = get(handles.YAuto,'Value');
        if val == 1
            ud = get(handles.FFTPlatForm,'UserData');
            Power = ud.PData;
            ymin = min(Power);
            ymax = max(Power);
            set(handles.Plot,'YLim',[ymin ymax]);
            set(handles.YMin,'String',num2str(ymin));
            set(handles.YMax,'String',num2str(ymax));
        else
            YMin_Callback;
            YMax_Callback;
        end
        % Set the Auto Parameter Enable on
        set(handles.YAuto,'Enable','off');
    end
    if p==3
        val = get(handles.YAuto,'Value');
        if val == 1
            ud = get(handles.FFTPlatForm,'UserData');
            Power_wrap = ud.PData_wrap;
            ymin = min(Power_wrap);
            ymax = max(Power_wrap);
            set(handles.Plot,'YLim',[ymin ymax]);
            set(handles.YMin,'String',num2str(ymin));
            set(handles.YMax,'String',num2str(ymax));
        else
            YMin_Callback;
            YMax_Callback;
        end
        % Set the Auto Parameter Enable on
        set(handles.YAuto,'Enable','off');
    end
end


function YMin_Callback(hObject, eventdata, handles)
% hObject    handle to YMin (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 YMin as text
%        str2double(get(hObject,'String')) returns contents of YMin as a double

ymin = str2double(get(handles.YMin,'String'));
y = get(handles.Plot,'YLim');
ymax = y(2);
set(handles.Plot,'YLim',[ymin ymax]);
set(handles.YAuto,'Value',0);
% Set the Auto Parameter Enable on
set(handles.YAuto,'Enable','on');



% --- Executes during object creation, after setting all properties.
function YMin_CreateFcn(hObject, eventdata, handles)
% hObject    handle to YMin (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



function YMax_Callback(hObject, eventdata, handles)
% hObject    handle to YMax (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 YMax as text
%        str2double(get(hObject,'String')) returns contents of YMax as a double

ymax = str2double(get(handles.YMax,'String'));
y = get(handles.Plot,'YLim');
ymin = y(1);
set(handles.Plot,'YLim',[ymin ymax]);
set(handles.YAuto,'Value',0);
% Set the Auto Parameter Enable on
set(handles.YAuto,'Enable','on');


% --- Executes during object creation, after setting all properties.
function YMax_CreateFcn(hObject, eventdata, handles)
% hObject    handle to YMax (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end



% --- Executes on button press in EVMCaculation.
function EVMCaculation_Callback(hObject, eventdata, handles)
% hObject    handle to EVMCaculation (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)



function InputData_Callback(hObject, eventdata, handles)
% hObject    handle to InputData (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 InputData as text
%        str2double(get(hObject,'String')) returns contents of InputData as a double


% --- Executes during object creation, after setting all properties.
function InputData_CreateFcn(hObject, eventdata, handles)
% hObject    handle to InputData (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes during object creation, after setting all properties.
function WindowSelection_CreateFcn(hObject, eventdata, handles)
% hObject    handle to WindowSelection (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 && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on selection change in VariableList.
function VariableList_Callback(hObject, eventdata, handles)
% hObject    handle to VariableList (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 VariableList contents as cell array
%        contents{get(hObject,'Value')} returns selected item from VariableList


% --- Executes during object creation, after setting all properties.
function VariableList_CreateFcn(hObject, eventdata, handles)
% hObject    handle to VariableList (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: listbox controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end




% --- Executes on button press in Plot.
function Plot_Callback(hObject, eventdata, handles)
% hObject    handle to Plot (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

val = get(handles.VariableList,'Value');


⌨️ 快捷键说明

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