Numerically solving an integral with multiple variables.

조회 수: 3 (최근 30일)
Ausamah Hobbi
Ausamah Hobbi 2018년 11월 28일
댓글: Ausamah Hobbi 2018년 11월 28일
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