From cbfd19d3fe6f4540845a72808d2e115a3d8c5494 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 24 Sep 2015 10:46:58 +0200 Subject: [PATCH] added fitting procedure for load over stiffness squared --- matlab_code/get_and_plot.m | 13 ++++++++-- matlab_code/gui/refresh_param_GUI.m | 5 ++++ matlab_code/gui/set_GUI.m | 22 ++++++++++++---- matlab_code/model_loadOverstiffnessSquared.m | 25 +++++++++++++++++++ .../plot/plot_exp_vs_mod_setvariables.m | 7 ++++++ 5 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 matlab_code/model_loadOverstiffnessSquared.m diff --git a/matlab_code/get_and_plot.m b/matlab_code/get_and_plot.m index 86e05fb..a206c30 100644 --- a/matlab_code/get_and_plot.m +++ b/matlab_code/get_and_plot.m @@ -33,7 +33,7 @@ if gui.variables.y_axis == 1 model_load_disp; gui = guidata(gcf); guidata(gcf, gui); - gui.results.P_fit = gui.results.P_fit/gui.data.loadFact; + gui.results.P_fit = gui.results.P_fit./gui.data.loadFact; guidata(gcf, gui); end @@ -41,7 +41,16 @@ if gui.variables.y_axis == 2 model_stiffness; gui = guidata(gcf); guidata(gcf, gui); - gui.results.S_fit = gui.results.S_fit/gui.data.stifFact; + gui.results.S_fit = gui.results.S_fit./gui.data.stifFact; + guidata(gcf, gui); + end + + %% Load over stiffness squared analysis + if gui.variables.y_axis == 3 + model_loadOverstiffnessSquared; + gui = guidata(gcf); guidata(gcf, gui); + gui.results.LS2_fit = gui.results.LS2_fit .* (gui.data.stifFact.^2) ./ ... + gui.data.loadFact; guidata(gcf, gui); end diff --git a/matlab_code/gui/refresh_param_GUI.m b/matlab_code/gui/refresh_param_GUI.m index 295602c..ea53a05 100644 --- a/matlab_code/gui/refresh_param_GUI.m +++ b/matlab_code/gui/refresh_param_GUI.m @@ -50,6 +50,11 @@ 'String', gui.handles.title_stiffness_model); set(gui.handles.value_model_GUI, ... 'String', gui.handles.list_stiffness_model); +elseif get(gui.handles.value_param2plotinyaxis_GUI , 'Value') == 3 + set(gui.handles.title_model_GUI, ... + 'String', gui.handles.title_loadOverstiffnessSquared_model); + set(gui.handles.value_model_GUI, ... + 'String', gui.handles.list_loadOverstiffnessSquared_model); elseif get(gui.handles.value_param2plotinyaxis_GUI , 'Value') == 4 || ... get(gui.handles.value_param2plotinyaxis_GUI , 'Value') == 5 if get(gui.handles.value_numthinfilm_GUI, 'Value') == 2 diff --git a/matlab_code/gui/set_GUI.m b/matlab_code/gui/set_GUI.m index 71aa69d..a374c83 100644 --- a/matlab_code/gui/set_GUI.m +++ b/matlab_code/gui/set_GUI.m @@ -349,7 +349,8 @@ % List for load-displacement models handles.title_load_disp_model = 'Load-Disp. Model'; -handles.list_load_disp_model = {'No_load_Disp_model',... +handles.list_load_disp_model = {... + 'No_model',... 'Loubet', ... 'Hainsworth'}; @@ -359,16 +360,25 @@ % List for stiffness models handles.title_stiffness_model = 'Stiffness Model'; -handles.list_stiffness_model = {'No_stiffness_model',... +handles.list_stiffness_model = {... + 'No_model',... 'Linear', ... '2nd degree polynomial'}; +% List for stiffness models +handles.title_loadOverstiffnessSquared_model = 'Load/(Stiffness squared) Model'; + +handles.list_loadOverstiffnessSquared_model = {.... + 'No_model',... + 'Linear'}; + % Titles popup menus handles.title_bilayermodel = 'Bilayer Model'; handles.title_multilayermodel = 'Multilayer Model'; % List for elastic bilayer/multilayer models -handles.list_bilayermodel = {'No_Bilayer_Model', ... +handles.list_bilayermodel = {... + 'No_Bilayer_Model', ... 'Doerner&Nix',... 'Doerner&Nix_King',... 'Doerner&Nix_Saha',... @@ -382,11 +392,13 @@ 'Mencik_etal._exponential',... 'Mencik_etal._reciprocal_exp.'}; -handles.list_multilayermodel = {'No_Multilayer_Model', ... +handles.list_multilayermodel = {... + 'No_Multilayer_Model', ... 'Mercier_etal.'}; % List for plastic bilayer/multilayer models -handles.list_bilayermodel_plastic = {'No_Model', ... +handles.list_bilayermodel_plastic = {... + 'No_Model', ... 'Han_etal',... 'Mercier_etal'}; diff --git a/matlab_code/model_loadOverstiffnessSquared.m b/matlab_code/model_loadOverstiffnessSquared.m new file mode 100644 index 0000000..a848381 --- /dev/null +++ b/matlab_code/model_loadOverstiffnessSquared.m @@ -0,0 +1,25 @@ +%% Copyright 2014 MERCIER David +function model_loadOverstiffnessSquared +%% Function used to analyze load over stiffness squared +gui = guidata(gcf); + +%% Fit of the (load over stiffness squared)-displacement curve +if gui.variables.val2 == 2 + % See also 'fitlm' function in Matlab for linear regression + polyCoeff = 1; + [Pfit Sfit] = polyfit(gui.data.h, (gui.data.P ./ (gui.data.S.^2)), polyCoeff); + gui.results.LS2_fit = Pfit(1).*gui.data.h + Pfit(2); % in mN/nm + gui.results.linear_fit = Pfit; + gui.results.residual = gui.results.LS2_fit - (gui.data.P ./ (gui.data.S.^2)); + gui.results.rSquare = r_square((gui.data.P ./ (gui.data.S.^2)), ... + gui.results.LS2_fit); +else + gui.results.linear_fit = [0 0 0]; + gui.results.LS2_fit = 0; + gui.results.residual = 0; + gui.results.rSquare = 0; +end + +guidata(gcf, gui); + +end \ No newline at end of file diff --git a/matlab_code/plot/plot_exp_vs_mod_setvariables.m b/matlab_code/plot/plot_exp_vs_mod_setvariables.m index b3cef35..41f2e50 100644 --- a/matlab_code/plot/plot_exp_vs_mod_setvariables.m +++ b/matlab_code/plot/plot_exp_vs_mod_setvariables.m @@ -98,8 +98,15 @@ elseif gui.variables.y_axis == 3 gui.axis.y2plot = gui.data.P ./ (gui.data.S.^2); gui.axis.delta_y2plot = gui.data.delta_P - 2*(gui.data.delta_S); + gui.axis.y2plot_2 = gui.results.LS2_fit; gui.axis.ylabelstr = 'Load oved Stiffness squared (1/GPa)'; gui.axis.ymax = max(gui.axis.y2plot); + if gui.variables.val2 == 2 + gui.axis.title_str = strcat('$L/S^2$ = (', ... + num2str(gui.results.linear_fit(1)), ')$h$ + (', ... + num2str(gui.results.linear_fit(2)), ')', ... + '/ $R^2 =$ ', num2str(gui.results.rSquare)); + end elseif gui.variables.y_axis == 4 gui.axis.y2plot = gui.results.Esample_red; gui.axis.delta_y2plot = 0;