quantum equation in matlab

Discussion in 'Programmer's Corner' started by theo23, Feb 25, 2009.

  1. theo23

    Thread Starter Member

    Nov 29, 2008
    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)))
    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

    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):

    Code ( (Unknown Language)):
    2. function subtotal1=integral1(ndot1,de1,v1)
    4. A=12.56e-4;  %this value is static,not change
    5. L=0.44;         %this value is static,not change
    6. G=2;             %this value is static,not change
    7. T=300.0;       %this value is static,not change
    8. q=1.6e-19;    %this value is static,not change  
    9. k=8.62e-5;    %this value is static,not change(Boltzman)  
    10. Edot1=-0.3;   %between -0.6-0.6    
    11. syms E;           %(define) E
    14. a=1/(1+exp((E-(v/L))/(k*T)));
    15. b=(G*ndot1)./(sqrt((pi*de1)/2));
    16. ek8eths1=((E+Edot1+(v/L))/de1).^2;
    17. c=exp(-2*ek8eths1);
    18. final1=a.*c*b;
    20. inline_final1 = vectorize (inline (char (final1)));
    21. 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.
    Code ( (Unknown Language)):
    2. clear all
    3. clc
    4. A=12.56e-4;
    5. L=0.44;
    6. q=1.6e-19;
    7. ep=13;
    8. e0=8.85e-14;
    9. Nd=2e15;
    10. Vbi=2;
    11. k=8.62e-5;
    12. T=300.0;
    13. i=1;
    15. %1st distribution
    16. ndot1=3e10;
    17. de1=0.1;
    18. %2nd distribution
    19. ndot2=9e10;
    20. de2=0.1;
    21. v=-12:0.05:1.5;
    22. C=A*(sqrt((q*ep*e0*Nd)./(2*(Vbi-v-k*T))));
    24.    for i=1:1;
    25.    for j=1:length(v)    
    26.     fintegrals1(j,i)=integral1(ndot1(i),de1(i),v(j));
    27.     fintegrals2(j,i)=integral2(ndot2(i),de2(i),v(j));
    28. end
    29. end
    31. deriv1=-(diff(fintegrals1))./0.05;  % (Q2-Q1)/(V2-V1)
    32. deriv2=-(diff( fintegrals2))./0.05;
    33. total1=deriv1.*(q*A*L);
    34. total2=deriv2.*(q*A*L);
    35. C=C.';       %1x280 to 280x1
    36. totaly=C+total1+total2;
    37. path(path,'c:\thodoris')          %here i have the experimental values
    38. load askisi2.txt          
    39. plot(askisi2(:,1),askisi2(:,2),v,totaly)
    40. title('Ari8mitikh Epilisi')
    41. xlabel('V')
    42. ylabel('Col')
    43. 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!!:)