Using the curve fitting tool to find fitting parameters of an integral.

3 views (last 30 days)
There is a pretty advanced integral that needs to be solved numerically. There are three parameters that need to be fitted: Vt, T, and r. Below is an image of the formulas needed.
Below the image is the code I have so far. All the data needed is in the excel spreedsheet attached. Please.
lab.jpg
clc;
%Short Channel
SVd = xlsread('W1umL60nm.xlsx', 'C4:C53');
SId0 = xlsread('W1umL60nm.xlsx', 'D56:D105');
SId2 = xlsread('W1umL60nm.xlsx', 'F56:F105');
SId4 = xlsread('W1umL60nm.xlsx', 'H56:H105');
SId6 = xlsread('W1umL60nm.xlsx', 'J56:J105');
SId8 = xlsread('W1umL60nm.xlsx', 'L56:L105');
SId10 = xlsread('W1umL60nm.xlsx', 'N56:N105');
SId12 = xlsread('W1umL60nm.xlsx', 'P56:P105');
% INITIALIZE MATLAB
close all;
clc;
clear all;
syms Vt
syms x
syms Ro
syms Vd
syms Vg
syms CoRo %Constant of p
syms p
%Vt = 0.7; %FOR NOW
%Vg = 2; %FOR NOW
CoRo = 1.652e+16;
%Vg = 0:0.2:1.2;
% Ro
p = CoRo*(Vg-Vt); %
% FUNCTIONS AND INTERVAL
a = @(SVd) 1+exp(Vd);
b = @(SVd)sqrt(a^2+4*exp(SVd)*(exp(p)-1));
u = @(SVd) log(b-(1+exp(SVd))-log(2));
f = @(u,x)sqrt(u)./(1+exp(u-x));
F = @(x)integral(@(u)f(u,x),0,inf, 'ArrayValued', true);

Answers (1)

Walter Roberson
Walter Roberson on 3 Dec 2018
you cannot use integral with symbolic variables like p
Get rid of your @() and define symbolic expressions with the last one in terms of int() . That will attempt to integrate and then return back aa symbolic expression in terms of int()
Now use matlabFunction to turn it into aa numeric function handle . be sure to use the vars option so you get the right order of variables .
you can then use that in aa fittype() and lsqcurvefit
  7 Comments
Ausamah Hobbi
Ausamah Hobbi on 4 Dec 2018
Hey Walter.
I've been playing around and this is what I have so far. I keep, however keep getting errors.
% INITIALIZE MATLAB
close all;
clc;
clear all;
syms Vt
syms x
syms Vd
syms Vg
syms Cop %Constant of p
syms r
Z = 1e-6;
q = 1.6e-19;
kT = 4.11e-21;
m0 = 9.1e-31;
hbar = 1.054e-34;
mt = .2 * m0;
mv = 2.5;
e0 = 8.85e-12;
er = 3.7;
Ci = .0163725;
%Defining Vg
Vg0 = 0;
Vg2 = 0.2;
Vg4 = 0.4;
Vg6 = 0.6;
Vg8 = 0.8;
Vg10 = 1.0;
Vg12 = 1.2;
%Short Channel
SVd = xlsread('W1umL60nm.xlsx', 'C4:C53');
SId0 = xlsread('W1umL60nm.xlsx', 'D56:D105');
SId2 = xlsread('W1umL60nm.xlsx', 'F56:F105');
SId4 = xlsread('W1umL60nm.xlsx', 'H56:H105');
SId6 = xlsread('W1umL60nm.xlsx', 'J56:J105');
SId8 = xlsread('W1umL60nm.xlsx', 'L56:L105');
SId10 = xlsread('W1umL60nm.xlsx', 'N56:N105');
SId12 = xlsread('W1umL60nm.xlsx', 'P56:P105');
Io = (sqrt(2).*q.*((kT)^1.5).*mv.*sqrt(mt))/((pi.^2).*(hbar).^2);
vd = @(Vd) (q.*r.*SVd)/(kT);
Ro = @(Vg) (2.*pi.*(hbar.^2).*Ci.*(Vg-Vt))./(q.*kT.*mt.*mv);
fermi_half = @(x) (x.^0.5)/(1+exp.^(x-a));
fermi_half_vd = @(x) (x.^0.5)/(1+exp.^(x-a+vd(Vd)));
%To get u(Vd, Vg)
a = @(Vd, Vg) sqrt((1 + exp.^(vd(Vd))).^2 + 4.*exp(vd(Vd)).*(math.exp(p(Vg)) - 1));
b = @(Vd)(1 + exp.^(vd(Vd)));
c = log(2);
u = @(Vd, Vg) log(a-b)-c
fermi_half_int = quadgk(fermi_half(x), 0, inf)
fermi_half_vd_int = quadgk(fermi_half_vd(x), 0, inf)
Walter Roberson
Walter Roberson on 4 Dec 2018
fermi_half_int = quadgk(fermi_half(x), 0, inf)
At that point, x refers to syms x, so fermi_half would be executed passing in symbolic variable f, returning a symbolic expression. Then you try to quadgk with that symbolic expression as the first parameter. quadgk is strictly for function handles, not symbolic. Perhaps
fermi_half_int = quadgk(fermi_half, 0, inf)

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!