Using the curve fitting tool to find fitting parameters of an integral.
3 views (last 30 days)
Show older comments
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.

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);
0 Comments
Answers (1)
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
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)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!