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

📄 performprony.m

📁 prony matlab toolbox
💻 M
📖 第 1 页 / 共 4 页
字号:
function menu_saveinfile_Callback(hObject, eventdata, handles)
% hObject    handle to menu_saveinfile (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% Flag to say that user has saved atleast one session
% Flag to say that user has saved atleast one session
     
[cmpfile, cmppath] = uiputfile( ...
    {'*.cmp', 'All CMP-Files (*.cmp)'},...
    'Save as a file');
if isequal(cmpfile,0) | isequal(cmppath,0)
         return
end
if ~ismember('.',cmpfile)
         cmpfile = [cmpfile '.cmp'];
end
set(handles.push_sessionscompare,'enable','on');
handles.menu_saveflag=1;
handles.menu_saveasflag=1;% flag to check option of save  Is it save as ??
guidata(hObject,handles); % store the changes
PronyResults=getPronyResults(handles);
FinalResults= selectedmodes_results(handles,PronyResults);
[SaveData,maxNum]= prepare_savedata(FinalResults,handles,hObject);
 cmpfullname=fullfile(cmppath,cmpfile);
 save(cmpfullname,'SaveData','maxNum','-mat');
guidata(hObject,handles); % store the changes
% Message to the user that data is saved
h_msg=msgbox('The Sessions are saved in Successfully in the file','Save Session','replace');
whitebg('white');
  
% --- Executes on button press in push_close.function push_close_Callback(hObject, eventdata, handles)% hObject    handle to push_close (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
close(gcf);% --- Executes on button press in push_sessionscompare.function push_sessionscompare_Callback(hObject, eventdata, handles)% hObject    handle to push_sessionscompare (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)if (handles.menu_saveflag==1)
    comparesessions;
    IIGuiData = prepare_guidata(handles);
    assignin('base','IIGuiData',IIGuiData);
else
    % Message to the user that data is saved
    warndlg('Please Save the Session to Use the Compare Sessions Tool !!',' Warning Save Session');
    whitebg('white');    
end% --------------------------------------------------------------------function menu_help_Callback(hObject, eventdata, handles)% hObject    handle to menu_help (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------
function menu_pronytool_Callback(hObject, eventdata, handles)
% hObject    handle to menu_pronytool (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
HelpPath = which ('pronytoolhelp.html');
web(HelpPath,'-browser');

% --------------------------------------------------------------------
function menu_about_Callback(hObject, eventdata, handles)
% hObject    handle to menu_about (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
HelpPath = which ('about.html');
web(HelpPath,'-browser'); 


% --------------------------------------------------------------------
function menu_demos_Callback(hObject, eventdata, handles)
% hObject    handle to menu_demos (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

HelpPath = which ('demos.html');
web(HelpPath,'-browser');

function [IIGuiData]= prepare_guidata(handles)
IIGuiData= struct('NewVal',[],'SUB_N',[],'iapp',[],'ai',[],...
		        'a_list',[],'tau_list',[],'omega_list',[],...
                'SUB_IND',[],'energy',[],'criteria_val',[],...
                'p',[],'mode_selectionid',[],'test_time',[],'test_data',[],...
                'f1',[],'fft_iapp1',[],'fft_data1',[],...
                'f2',[],'fft_iapp2',[],'fft_data2',[],...
                'inummz',[],'idennz',[],'seerror',[],'aa_list',[],...
                'all_res',[],'res_SUBIND',[]);
                
PronyResults=getPronyResults(handles);
FinalResults=selectedmodes_results(handles,PronyResults);  
IIGuiData=FinalResults;
FirstResults=save_FirstResults(handles);
IIGuiData.iapp=FirstResults.iapp;
IIGuiData.test_time=handles.test_time;
IIGuiData.test_data=handles.test_data;
[f1,fft_data1,fft_iapp1]= fft_analysis(handles.test_time,handles.test_data,FirstResults.iapp);
IIGuiData.f1=f1;
IIGuiData.fft_iapp1=fft_iapp1;
IIGuiData.fft_data1=fft_data1;
[f2,fft_data2,fft_iapp2]= fft_analysis(handles.test_time,handles.test_data,FinalResults.ai);
IIGuiData.f2=f2;
IIGuiData.fft_iapp2=fft_iapp2;
IIGuiData.fft_data2=fft_data2;
[IIGuiData.inummz,IIGuiData.idennz]=residuez(FinalResults.a_list(FinalResults.SUB_IND),FinalResults.p(FinalResults.SUB_IND),1);
IIGuiData.seerror=(handles.test_data(:)-FinalResults.ai(:)).^2;
IIGuiData.aa_list=abs(2*FinalResults.a_list(FinalResults.SUB_IND'));
IIGuiData.all_res= abs(2*FirstResults.a_list(FirstResults.SUB_IND'));
IIGuiData.res_SUBIND=FirstResults.SUB_IND;
IIGuiData.energy=FirstResults.energy;% --------------------------------------------------------------------function cmenu_pronyfit_Callback(hObject, eventdata, handles)% hObject    handle to cmenu_pronyfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_pronyfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_pronyfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_time_pronyfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_time_pronyfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)IIGuiData = prepare_guidata(handles);
figure('Color','White');
plot(IIGuiData.test_time,IIGuiData.iapp,'r',IIGuiData.test_time,IIGuiData.test_data,'b');
xlabel('Time'),ylabel('Signal');
title(sprintf('Prony Analysis of Model Order %d in Time Domain',IIGuiData.NewVal))
legend('Prony Approximate', 'Measured')
        
    % --------------------------------------------------------------------function plotnew_frequency_pronyfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_frequency_pronyfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA) % implement frequency domain prony
IIGuiData = prepare_guidata(handles);
figure('Color','White');
plot(IIGuiData.f1,IIGuiData.fft_iapp1,'r',IIGuiData.f1,IIGuiData.fft_data1,'b');
xlabel('Frequency'),ylabel('  Magnitude (dB)  ');
title(sprintf('Prony Analysis of Model Order %d in Frequency Domain',IIGuiData.NewVal))
legend('Prony Approximate', 'Measured')

% --------------------------------------------------------------------function cmenu_modesfit_Callback(hObject, eventdata, handles)% hObject    handle to cmenu_modesfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_modesfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_modesfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_time_modesfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_time_modesfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)IIGuiData = prepare_guidata(handles);
figure('Color','White');
plot(IIGuiData.test_time,IIGuiData.ai,'r',IIGuiData.test_time,IIGuiData.test_data,'b');
title(sprintf('Prony Approximation of Model Order %d, Picking %d Residues',IIGuiData.NewVal,IIGuiData.SUB_N));
legend('Prony Sub-Approximate','Measured');
ylabel('Signal'),xlabel('Time');
% --------------------------------------------------------------------function plotnew_frequency_modesfit_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_frequency_modesfit (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)IIGuiData = prepare_guidata(handles);
figure('Color','White');
plot(IIGuiData.f2,IIGuiData.fft_iapp2,'r',IIGuiData.f2,IIGuiData.fft_data2,'b');
title(sprintf('Prony Approximation of Model Order %d, Picking %d Residues in Frequency Domain',IIGuiData.NewVal,IIGuiData.SUB_N));
legend('Prony Sub-Approximate','Measured');% place it at lower right corner of the axis
xlabel('Frequency');
ylabel('Magnitude (dB)');% --------------------------------------------------------------------function cmenu_seerror_Callback(hObject, eventdata, handles)% hObject    handle to cmenu_seerror (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_seerror_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_seerror (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)% --------------------------------------------------------------------function plotnew_serror_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_serror (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)
    IIGuiData = prepare_guidata(handles);
    figure('Color','White');    plot(IIGuiData.test_time,IIGuiData.seerror,'b');xlabel('Time'), ylabel('Squared Error')
    title(sprintf('Squared Error for Model Order %d and Picking %d Residues',IIGuiData.NewVal,size(IIGuiData.SUB_IND,2)))
     % --------------------------------------------------------------------function plotnew_polezero_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_polezero (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)    IIGuiData = prepare_guidata(handles);
    figure('Color','White');
    zplane(IIGuiData.inummz,IIGuiData.idennz,'y');axis([-1.1 1.1 -1.1 1.1]),xlabel('Real Part'), ylabel('Imaginary Part')
    title('Poles Zero Plot')
    % --------------------------------------------------------------------function plotnew_sortedres_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_sortedres (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)    IIGuiData = prepare_guidata(handles);
    figure('Color','White');
    max_aa=max(IIGuiData.aa_list)+1;
    Index=1:size(IIGuiData.SUB_IND,2);
    plot(Index,IIGuiData.aa_list,'b'), axis([0.9 max(Index)+0.1 0 max_aa]),xlabel('Index'), ylabel('Residue Magnitude')
    title(sprintf('Prony Residue Magnitude "Decay" for %d Modes',max(Index)))

% --------------------------------------------------------------------function plotnew_poles_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_poles (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)    IIGuiData = prepare_guidata(handles);
    figure('Color','White');
    zplane(0,IIGuiData.idennz,'y');axis([-1.1 1.1 -1.1 1.1]);xlabel('Real Part')
    ylabel('Imaginary Part'),title('Poles Plot');
% --------------------------------------------------------------------function plotnew_allres_Callback(hObject, eventdata, handles)% hObject    handle to plotnew_allres (see GCBO)% eventdata  reserved - to be defined in a future version of MATLAB% handles    structure with handles and user data (see GUIDATA)    IIGuiData = prepare_guidata(handles);

⌨️ 快捷键说明

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