Numerically solving an integral with multiple variables.

3 Ansichten (letzte 30 Tage)
Ausamah Hobbi
Ausamah Hobbi am 28 Nov. 2018
Kommentiert: Ausamah Hobbi am 28 Nov. 2018
Hello. I am in dire need of help. I'm trying to numerically solve this integral, the Formula is on the third page (of the attached pdf) -- the F(1/2). I've tried different function handles but am coming up with nothing. Here are some things that I tried. I want Vg and Vd to be varying with this. Don't give me the whole answer but where can I even start? How do I start? I'm just unsure how to integrate at this point.
% INITIALIZE MATLAB
close all;
clc;
clear all;
syms x
syms Ro
syms Vd
syms Vg
syms CoRo %Constant of p
syms p
Vt = 0.7;
Vg = 2;
CoRo = 1.652e+16;
%Vg = 0:0.2:1.2;
% Ro
p = CoRo*(Vg-Vt);
% FUNCTIONS AND INTERVAL
a = @(Vd) 1+exp(Vd);
b = @(Vd)sqrt(a^2+4*exp(Vd)*(exp(p)-1));
u = @(Vd) log(b-(1+exp(Vd))-log(2));
f = @(u) sqrt(u)/(1+exp(u-x));
%a = inline(1+exp(Vd));
%b = inline('sqrt(a^2+4*exp(Vd)*(exp(p)-1))','Vd');
%u = inline('log(b-(1+exp(Vd))-log(2))','Vd');
%f = inline('sqrt(u)/(1+exp(u-x))','u');
d = integral(f,0,5)
% INTEGRAL
%Starting value
%s = 0;
%Ending value
%e = 5;
%F = integral(f,s,e);
% NUMBER OF POINTS
N = 10;
% INTEGRAL OF f

Antworten (1)

Torsten
Torsten am 28 Nov. 2018
Bearbeitet: Torsten am 28 Nov. 2018
f = @(u,x)sqrt(u)./(1+exp(u-x));
F = @(x)integral(@(u)f(u,x),0,Inf,'ArrayValued',true);
F([2 4])
  1 Kommentar
Ausamah Hobbi
Ausamah Hobbi am 28 Nov. 2018
Thank you! It works. Now just some questions for my own reference, if you don't mind.
  • What does 'ArrayValued' do?
  • What does F([2 4]) do? Is it just values for x at 2 and 4?
  • What does the '.' do in the first line?
My next part of this is to vary the value of Vg. Does what I have "Vg = 0:0.2:1.2;" work? As well as varying Vd for which I have an excel file for. Any suggestions there?
Thank you very much!

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by