problem with my code in Matlab

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

  1. theo23

    Thread Starter Member

    Nov 29, 2008
    16
    0
    Hi,
    I have a problem with my code and i need your help.This is my code

    A=12.56e-4;
    L=0.44;
    G=2;
    T=300;
    q=1.6e-19;
    k=8.62e-5;
    Edot=0.05;
    Ndot=5e9;
    DE=0.25;
    syms E;
    denom=1+exp((E-(v/L))/(k*T));
    function1=1./denom;
    static=(G*Ndot)/(sqrt((pi*DE)/2));
    ek8eths=((E+Edot+(v/L))/DE).^2;
    function2=exp(-2*ek8eths);
    final=function1.*function2.*static;
    inline_final = vectorize (inline (char (final)));
    subtotal = quad (inline_final, 0, 1e12);

    When i run it with values v=-1,-2 for example then the program gives me a solution,the integral which i want.When i try to run it for a matrix of v 281x1(-12:0.05:2) then i have these errors

    ??? Error using ==> inlineeval

    Error in inline expression ==> array([[67930201350122255859375./549755813888./(772894735361391./1125899906842624+772894735361391./1125899906842624.*exp(50000./1293.*E+200000./431)).*exp(-2.*(10./3.*E-119./3).^2)]....................[67930201350122255859375./549755813888./(772894735361391./1125899906842624+77
    2894735361391./1125899906842624.*e

    Error in ==> C:\MATLAB6p5\toolbox\matlab\funfun\@inline\feval.m
    On line 34 ==> INLINE_OUT_ = inlineeval(INLINE_INPUTS_, INLINE_OBJ_.inputExpr, INLINE_OBJ_.expr);

    Error in ==> C:\MATLAB6p5\toolbox\matlab\funfun\quad.m
    On line 59 ==> y = feval(f, x, varargin{:});

    Error in ==> C:\MATLAB6p5\work\integral.m
    On line 28 ==> subtotal = quad (inline_final, 0, 1e13);

    Can anyone knows where is the problem in inline_final and subtotal function?
    Thank you
     
Loading...