From: Anabel on 12 Feb 2010 18:27 HI guys, I am trying to integrate a complex exponential function, but getting the error: ??? Undefined function or method 'int' for input arguments of type 'double' Any suggestions why? any help is very appreciated as not experienced with matlab..Thanks alot. syms a x unreal % >> a = 5 +j; >> x= 0:0.1:10; >> f = exp(-a*x); F = int(f, x, 0, inf) Ana
From: Walter Roberson on 12 Feb 2010 18:56 Anabel wrote: > I am trying to integrate a complex exponential function, but getting the > error: ??? Undefined function or method 'int' for input arguments of > type 'double' > Any suggestions why? any help is very appreciated as not experienced > with matlab..Thanks alot. > > syms a x unreal % >>> a = 5 +j; >>> x= 0:0.1:10; You gave x a specific numeric value, overriding its property of being symbolic. >>> f = exp(-a*x); As j is sqrt(-1), and x is numeric, all of the components of exp(-a*x) are numeric, so f is computed numerically rather than as a function. > F = int(f, x, 0, inf) And now you pass the numeric vector in to int() in the place that int() expects the symbolic formula that is to be integrated.
From: Anabel on 13 Feb 2010 03:23 hi, I can not understand it,but is there then an integration function that would able to calculate if only given eg. syms a x unreal % >> a = 5 +j; >> x= 0:0.1:10; >> f = exp(-a*x); F = int(f, x, 0, inf) then, x is not numeric anymore, but still get the same answer...should i use dblquad? thanks loads ana Walter Roberson <roberson(a)hushmail.com> wrote in message <hl4qag$rhs$1(a)canopus.cc.umanitoba.ca>... > Anabel wrote: > > > I am trying to integrate a complex exponential function, but getting the > > error: ??? Undefined function or method 'int' for input arguments of > > type 'double' > > Any suggestions why? any help is very appreciated as not experienced > > with matlab..Thanks alot. > > > > syms a x unreal % > >>> a = 5 +j; > >>> x= 0:0.1:10; > > You gave x a specific numeric value, overriding its property of being symbolic. > > >>> f = exp(-a*x); > > As j is sqrt(-1), and x is numeric, all of the components of exp(-a*x) are > numeric, so f is computed numerically rather than as a function. > > > F = int(f, x, 0, inf) > > And now you pass the numeric vector in to int() in the place that int() > expects the symbolic formula that is to be integrated.
From: Steven Lord on 13 Feb 2010 16:13 "Anabel " <anabelbonello(a)hotmail.com> wrote in message news:hl5nha$l7h$1(a)fred.mathworks.com... > hi, > > I can not understand it,but is there then an integration function that > would able to calculate if only given eg. > > syms a x unreal % >>> a = 5 +j; >>> x= 0:0.1:10; As Walter said, once you execute the previous line x is no longer symbolic and so neither is f. Thus INT, which requires its first input to be symbolic, doesn't know what to do. Remove the previous line and INT will no longer throw this error. >>> f = exp(-a*x); > F = int(f, x, 0, inf) > > then, x is not numeric anymore, but still get the same answer...should i > use dblquad? If you're trying to integrate a symbolic expression, use INT. If you're trying to integrate a function for which you have a function handle (like @sin), use QUAD and related functions. If you're trying to integrate a vector of values, the value of the function at selected points, use TRAPZ and related functions. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: Anabel on 14 Feb 2010 09:58 Hi, I have though an enquiry if, i need to integrate for instance e^(-kt) but i do not want as return a value, but an expression, then i guess i have to use syms? Thanks alot A "Steven Lord" <slord(a)mathworks.com> wrote in message <hl74ml$ekp$1(a)fred.mathworks.com>... > > "Anabel " <anabelbonello(a)hotmail.com> wrote in message > news:hl5nha$l7h$1(a)fred.mathworks.com... > > hi, > > > > I can not understand it,but is there then an integration function that > > would able to calculate if only given eg. > > > > syms a x unreal % > >>> a = 5 +j; > >>> x= 0:0.1:10; > > As Walter said, once you execute the previous line x is no longer symbolic > and so neither is f. Thus INT, which requires its first input to be > symbolic, doesn't know what to do. Remove the previous line and INT will no > longer throw this error. > > >>> f = exp(-a*x); > > F = int(f, x, 0, inf) > > > > then, x is not numeric anymore, but still get the same answer...should i > > use dblquad? > > If you're trying to integrate a symbolic expression, use INT. > If you're trying to integrate a function for which you have a function > handle (like @sin), use QUAD and related functions. > If you're trying to integrate a vector of values, the value of the function > at selected points, use TRAPZ and related functions. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ >
|
Pages: 1 Prev: GOTO BLAS and FAST algorithm Next: Hough Transform codes in file exchange - problems |