Numerically solving an integral with multiple variables.

3 次查看(过去 30 天)
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

回答(1 个)

Torsten
Torsten 2018-11-28
编辑:Torsten 2018-11-28
f = @(u,x)sqrt(u)./(1+exp(u-x));
F = @(x)integral(@(u)f(u,x),0,Inf,'ArrayValued',true);
F([2 4])
  1 个评论
Ausamah Hobbi
Ausamah Hobbi 2018-11-28
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!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by