Code covered by the BSD License  

Highlights from
nanoind_data_analysis

image thumbnail

nanoind_data_analysis

by

 

06 Sep 2013 (Updated )

A MATLAB GUI to plot and to analyze (nano)indentation data (obtained with conical indenters)

plot_exp_vs_mod.m
%% Copyright 2013 MERCIER David
%% Script to plot experimental data + model
%% Initialization
set(MainWindows, 'CurrentAxes', AxisPlot_GUI);
cla reset; clear xline; clear yline;
log_plot_value  =  get(cb_log_plot_GUI, 'Value');

if log_plot_value == 0
    
    if val3 == 1
        xline = [t, t];
        yline = [0, ymax];
        
    elseif val3 == 3
        xline = [1, 1];
        yline = [0, ymax];
        
    else
        xline = 0;
        yline = 0;
        
    end
    
elseif  log_plot_value == 1
    
    if val3 == 1
        xline = [t, t];
        
        if (min(y2plot) < min(y2plot_2))
            yline = [min(y2plot), ymax];
            
        else
            yline = [min(y2plot_2), ymax];
            
        end
        
    elseif val3 == 3
        xline = [1, 1];
        
        if min(y2plot) < min(y2plot_2)
            yline = [min(y2plot), ymax];
            
        else
            yline = [min(y2plot_2), ymax];
            
        end
        
    else
        xline = 0;
        yline = 0;
        
    end
end

%% Definiton of the plot
if num_thinfilm  >= 3
    val2 = val2_mm;
end

if log_plot_value == 0
    
    if val2 == 1
        
        if val4 ~= 1
            
            plot_data = plot(x2plot, y2plot, 'rx', xline, yline,  '--ko', 'LineWidth', 2);
            legend('Initial data', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
            
        else
            plot_data = plot(x2plot, y2plot, 'rx', x2plot, y2plot_2, 'b-', xline, yline,  '--ko', 'LineWidth', 2);
            legend('Initial data','Polynomial Model', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
            
        end
        
    elseif val2 ~= 1
        
        if val4 == 3 || val4 == 4
            
            plot_data = plot(x2plot, y2plot, 'rx', x2plot, y2plot_2, 'b+', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', legend2, 'Location', 'NorthWest');
            
        else
            plot_data = plot(x2plot, y2plot, 'rx', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
            
        end
    end
    
elseif log_plot_value == 1
    
    if val2 == 1
        if val4 ~= 1
            plot_data = loglog(x2plot, y2plot, 'rx', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
        else
            plot_data = loglog(x2plot, y2plot, 'rx', x2plot, P_fit, 'b-', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', 'Polynomial Model', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
        end
        
    elseif val2 ~= 1
        
        if val4 == 3 || val4 == 4
            
            plot_data = loglog(x2plot, y2plot, 'rx', x2plot, y2plot_2, 'b+', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', legend2, 'Location', 'NorthWest');
            
        else
            plot_data = loglog(x2plot, y2plot, 'rx', xline, yline, '--ko', 'LineWidth', 2);
            legend('Initial data', 'Location', 'NorthWest');
            title(title_str, 'FontSize', 18);
            
        end
    end
end
%% Plot properties
if get(value_numthinfilm_GUI, 'Value') ~= 1
    text(xline(1), ymax-0.05*ymax, ' \leftarrow Thin Film 0', 'FontSize', 12);
end

if num_thinfilm == 1 && ((val4 == 3) || (val4 == 4))
    set(value_youngsub_GUI, 'String', round(mean(Esample)));
    title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(mean(Esample))), 'GPa'], 'FontSize', 18);
    
elseif num_thinfilm == 2
    
    if val4 == 3 && val2 ~= 4
        set(value_youngfilm0_GUI, 'String', round(Ef_sol_fit));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol_fit)), 'GPa'], 'FontSize', 18);
        
    elseif val4 == 3 && val2 == 4
        set(value_youngfilm0_GUI, 'String', round(Ef_sol_fit(1)));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol_fit(1))), 'GPa',' / n(Pierrot-et_al.) = ', num2str(Ef_red_solfit(2))], 'FontSize', 18);
    
    elseif val4 == 4 && val2 ~= 4
        set(value_youngfilm0_GUI, 'String', round(Ef_sol));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol)), 'GPa'], 'FontSize', 18);
    
    elseif val4 == 4 && val2 == 4
        set(value_youngfilm0_GUI, 'String', round(Ef_sol));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol)), 'GPa', ' / n(Pierrot-et_al.) = ', num2str(Ef_red_solfit(2))], 'FontSize', 18);
    
    end
    
elseif num_thinfilm == 3
    
    if val4 == 3
        set(value_youngfilm1_GUI, 'String', round(Ef_sol_fit));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol_fit)), 'GPa'], 'FontSize', 18);
    
    elseif val4 == 4
        set(value_youngfilm1_GUI, 'String', round(Ef_sol));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol)), 'GPa'], 'FontSize', 18);
    
    end
    
elseif num_thinfilm == 4
    
    if val4 == 3
        set(value_youngfilm2_GUI, 'String', round(Ef_sol_fit));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol_fit)), 'GPa'], 'FontSize', 18);
    
    elseif val4 == 4
        set(value_youngfilm2_GUI, 'String', round(Ef_sol));
        title(['Mean Young''s modulus of the film (when h < t) = ', num2str(round(Ef_sol)), 'GPa'], 'FontSize', 18);
    
    end
    
end

%% Plot properties
xlabel(xlabelstr, 'Color', [0,0,0], 'FontSize', 14);
ylabel(ylabelstr, 'Color', [0,0,0], 'FontSize', 14);
xlim([xmin xmax]);
ylim([0 ymax]);
set(AxisPlot_GUI, 'FontSize', 14);
set(plot_data, 'MarkerSize', 10);
grid on;

Contact us