我有标准化y_val
的透射值(如方程)和入射注量值(x_val
如方程)。这是一个非常熟悉且经常使用的公式,尤其是用于非线性光学中的光学限制器的公式。
我需要拟合Normalized_T
vsEnergy per pulse
线并导出两个参数,F_sat
并且k
. 我有Normalized_T
和Energy per pulse
价值观(1X10 矩阵)。
在绘制作为实验数据的黄线时,计算红线。但我不明白为什么盒子颜色有不同的颜色。
我的问题是如何将这个超越方程拟合到数据集。到目前为止,我已经能够以数值方式求解方程并导出参数,但它似乎不是一个合适的,而是一个插值。
如果我没记错的话,参数可以用数值推导出来。但是,我的问题是拟合实际数据并且必须得出包含误差范围的拟合曲线。
我的代码:
% In this CODE:
%You are deriving numerically F_sat and kappa values and then put them in the transcendental eq. and use them inside the function and replot it against the original plotting.
% I could not achieve to load data file so I write them down here:
y_val = [1.0117,1.0058,0.9891,0.9265,0.8261,0.7391,0.6939,0.5435,0.4365,0.2400];
x_val = [0.0494,0.0563,0.0604,0.0633,0.0655,0.067,0.0689,0.0702,0.0714,0.0724];
Energy_per_pulse = x_val;
Normalized_T = y_val;
%Constants of ABSORPTION COEFFs:#####################################
alpha0 = 0.021;%[1/cm]%SAMPLE 1b
%#####################################################################
%These are the initial parameters for F_sat and kappa!
% Fsat2 = k(1) and kappa2 = k(2);These are two parameters substracted from
% the myfunc numerical solution.!
k0 = [28; 26.01];
%####################################################################
myfunc =@(k,x_val,v_val) y_val-exp(-alpha0*0.1).*(((k(1) + k(2).*y_val.*x_val)./(k(1)+k(2).*x_val))).^(1-1/k(2));
k = lsqcurvefit(myfunc,k0,x_val,y_val);
Fsat2= real(k(1,1));
kappa2=real(k(2,1));
figure(1)
plot1 =plot(Energy_per_pulse,Normalized_T);
semilogx(Energy_per_pulse,Normalized_T,'-o','MarkerSize',10)
hold on
Func1 = y_val-exp(-alpha0*0.1).*(((Fsat2 + kappa2.*y_val.*x_val)/(Fsat2+kappa2.*x_val))).^(1-1/kappa2);
plot2 = plot(Energy_per_pulse,Func1);
semilogx(Energy_per_pulse,Func1,'.','MarkerSize',10)
legend({'Experimental Data','Numerical Data'},'FontSize',12)
grid on;
title('Transmitted Int v.s. Energy per pulse for Sample (1b)', 'FontSize', 12, 'Color', 'b', 'FontWeight', 'bold');
%Make labels for the two axes.
ylabel('Transmitted Intensity [a.u.]');
xlabel('Fluence [J/cm^2]');
xlim([0.045 0.08])
ylim([0 1.2])
hold on
txt1 = ['Fsat value :',num2str(Fsat2) '[J/cm2]'];
txt2 = ['kappa value :',num2str(kappa2)];
text(0.05,0.1,txt1)
text(0.05,0.15,txt2)