1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
function [structure]=optim2('file_temp', 'file_hardness', 'tab_hardness')
% Looking for the number of data, [line columns]
nb_data=size(file_temp);
% Get values of the hardness
Excel = actxserver('Excel.Application');
set(Excel, 'Visible', false);
xlspath = '.\' ;
xlsfile = 'file_hardness' ;
Workbook = Excel.Workbooks.Open(fullfile(xlspath,xlsfile));
ActiveSheet = Excel.Worksheets.Item('tab_hardness');
r(1) = ActiveSheet.Range('R7');
r(2) = ActiveSheet.Range('R7').End('xlDown');
ydata = ActiveSheet.get('Range',r(1),r(2)).Value;
Workbook.Close(false);
Quit(Excel);
% Get values of temperature, etc...
fichier=dlmread('file_temp');
xdata=fichier(:,3:nb_data(2));
%% OPTIM
% script to optimise ki values in classical QFA (eq. 3 and not 4 in Shuhui
% Ma et al.) with Sigma_min=0 and Avrami exponent n = 1
% upper bound
ku = [30.0 10.0 10.0 20.00];
% lower bound
kl = [1 1 1 1];
% initial guess
k0 = [7.0000 7.9800 7.7800 13.0056];
[k,RESNORM,RESIDUAL,EXITFLAG,OUTPUT]= lsqcurvefit('fun', k0, xdata, ydata, kl, ku);
%% Creation of the structure
structure.HV = HV_pred;
structure.k = k;
structure.Q = Q;
%% Graphics
figure(2)
for i=1:30
x(i) =i;
end
% Superposition points expérimentaux et fittés.
plot (x, ydata, '*r', x, fun(k, xdata), '+b')
xlabel('Position');
ylabel('HV');
title('Strength in function of the position');
figure(3)
plot(x, fun(k,xdata))
figure(4)
plot(fun(k,xdata),ydata)
xlabel('HV predicted');
ylabel('HV measured');
title('HV predicted VS HV measured');
end |
Partager