Definite Integration w.r.t one variable and plotting w.r.t another variable

2 views (last 30 days)
I am trying to write a code for performing an definite integration w.r.t to variable E from 0 to infinity while plotting w.r.t to variable Va. That means that I have to perform definite integration w.r.t to variable E from 0 to infinity at each value of Va and plot the value integration w.r.t Va. Below is my effort to write the function
En = 0;
E = En*1.602*10^-19;
q = 1.6*10^-19;
T = 300;
Va = 0:0.01:10;
Ef = 1.695*1.6*10^-19;
K = 5.5*10^30;
kb = 1.38*10^-23;
TE = zeros(length(Va));
J = zeros(length(Va));
for i=1:length(Va)
TE(i) = rtdoff(Va(i), E , 10 , 0 );
a = 0;
b = 50000;
J = @(E,Va) K.*TE(i)*log((1+exp((Ef-E)./(kb.*T)))/(1+exp((Ef-E-(q.*Va(i))./(kb*T)))));
f(i) = @Va integral(@(E) J(E,Va),0,50000) ;
end
semilogy(Va,f);
hold on
rtdoff is a function that returns a double value.
But the code above is not working returning one error or another. Please suggest me a way so that I can perform the function.

Answers (0)

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!