Skip to content

Commit

Permalink
added fitting procedure for load over stiffness squared
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Sep 24, 2015
1 parent d1eafd6 commit cbfd19d
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 7 deletions.
13 changes: 11 additions & 2 deletions matlab_code/get_and_plot.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,24 @@
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

%% Stiffness analysis
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

Expand Down
5 changes: 5 additions & 0 deletions matlab_code/gui/refresh_param_GUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 17 additions & 5 deletions matlab_code/gui/set_GUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -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'};

Expand All @@ -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',...
Expand All @@ -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'};

Expand Down
25 changes: 25 additions & 0 deletions matlab_code/model_loadOverstiffnessSquared.m
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions matlab_code/plot/plot_exp_vs_mod_setvariables.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cbfd19d

Please sign in to comment.