Jump to content

equation in matlab

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
theo23

theo23

    Newbie

  • Members
  • Pip
  • 2 posts
hi, I have this equation and i want to insert it in matlab..Which is the best way to insert it?
Cdot=qAL∂/∂v∫(1/(1+(exp(E-qVdot)/kT))*(gNdot/sqrt(piM/2))*exp(-2((E+Edot+qVdot)/M)^2)dE.
Where vdot is the voltage across the quantum dots,L is the level arm coefficient,Edot is the confined energy level,M is the energy dispersion and ndot is the total number of dots.
Now i want to insert it for vdot(-12:0.05:2),and the integral is [0,inf] with respect to E.
Also,A=12.56e-4,L=0.44;,G=2,T=300,q=1.6e-19,k=8.62e-5

The idea of this exercise is to insert the theoretical Cdot(Matlab),with the results which it'll give me,i want to create a theoretical graph with axis x(v) and y(Cdot).Finally this graph i want to compare it with one experimental graph which i have.Summary,my goal is to find the best combination of ndot,M,edot in which the theoretical graph to be quite similar to experimental graph(sorry for my bad English).
Do you want to post my code which i created?
Thank you!

Edited by theo23, 24 February 2009 - 05:46 AM.


#2
theo23

theo23

    Newbie

  • Members
  • Pip
  • 2 posts
Hi everyone,
i have a difficult exercise in matlab and i need your help if anyone knows.
The idea of this exercise is to insert a theoretical equation Cdot in Matlab.With the results which it'll give me,i want to create a theoretical graph with axis x(v) and y(Cdot).Finally this graph i want to compare it with one experimental graph which i have.Summary,my goal is to find the best combination of ndot,M,edot in which the theoretical graph to be quite similar to experimental graph(sorry for my bad English).

The equation which i have is:
a=1/(1+exp((E - Vdot)/(k*T)))
b=(G*Ndot)/sqrt((pi*M)/2)
c=exp(-2((E + Edot + Vdot)/M)^2)
Cdot=q*A*L∂/∂v∫a*b*c dE

where Vdot=v/L and M=de(this name i gave it in my code).The integral i want to be [0,+inf] with respect to E.
The total equation which i want to insert in matlab is Total=Cdot1+Cdot2+C.
Cdot1,Cdot2 are 2 different distrubutions and
C=A*(sqrt((q*ep*e0*Nd)./(2*(Vbi-v-k*T))))

Now the code which i thought is:
Firstly,i make 2 m-files with names integral1,integral2 which has this function(everything i do here is the same with m-file integral2):


function subtotal1=integral1(ndot1,de1,v1)


A=12.56e-4;  %this value is static,not change

L=0.44;         %this value is static,not change

G=2;             %this value is static,not change

T=300.0;       %this value is static,not change

q=1.6e-19;    %this value is static,not change   

k=8.62e-5;    %this value is static,not change(Boltzman)   

Edot1=-0.3;   %between -0.6-0.6    

syms E;           %(define) E



a=1/(1+exp((E-(v/L))/(k*T)));

b=(G*ndot1)./(sqrt((pi*de1)/2));

ek8eths1=((E+Edot1+(v/L))/de1).^2;

c=exp(-2*ek8eths1);

final1=a.*c*b;


inline_final1 = vectorize (inline (char (final1)));

subtotal1 = quad (inline_final1,0,1e13);

My problem is the last 2 lines.I'm not sure if this is the best way to find the integral.Also,if i try quad (inline_final1,0,inf) then all the values are NaN.Why?

The 2nd code is an m-file with name derivative.

clear all

clc

A=12.56e-4;

L=0.44;

q=1.6e-19;

ep=13;

e0=8.85e-14;

Nd=2e15;

Vbi=2;

k=8.62e-5;

T=300.0;

i=1;


%1st distribution

ndot1=3e10;

de1=0.1;

%2nd distribution

ndot2=9e10;

de2=0.1;

v=-12:0.05:1.5;

C=A*(sqrt((q*ep*e0*Nd)./(2*(Vbi-v-k*T))));


   for i=1:1; 

   for j=1:length(v)    

    fintegrals1(j,i)=integral1(ndot1(i),de1(i),v(j));

    fintegrals2(j,i)=integral2(ndot2(i),de2(i),v(j));

end

end


deriv1=-(diff(fintegrals1))./0.05;  % (Q2-Q1)/(V2-V1)

deriv2=-(diff( fintegrals2))./0.05;

total1=deriv1.*(q*A*L);

total2=deriv2.*(q*A*L);

C=C.';       %1x280 to 280x1

totaly=C+total1+total2;

path(path,'c:\thodoris')          %here i have the experimental values

load askisi2.txt           

plot(askisi2(:,1),askisi2(:,2),v,totaly)

title('Ari8mitikh Epilisi')

xlabel('V')

ylabel('Col')

legend('peiramatiki','8ewritiki')


This is the huge code which i thought.Maybe when you see that you have headache.
But my really problem is how to calculate the integral and about that i need your help if anyone knows.
Thank You!!:)

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
I don't know that we have anyone familiar with matlab on this forum.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog