From: Andrea on 31 Jul 2010 06:54 I need to calculate divergence of a vector field, maybe Is the most stupid mistake ever made but I really need a solution >> syms x y g, u=x*exp(-(x^2+y^2)/g^2); v=y*exp(-(x^2+y^2)/g^2); >> div=divergence(x,y,u,v) ??? Error using ==> sym.double at 29 DOUBLE cannot convert the input expression into a double array. If the input expression contains a symbolic variable, use the VPA function instead. Error in ==> divergence at 35 u = double(u);
From: us on 31 Jul 2010 07:14 "Andrea " <none(a)hotmail.com> wrote in message <i30vce$hqd$1(a)fred.mathworks.com>... > I need to calculate divergence of a vector field, maybe Is the most stupid mistake ever made but I really need a solution > > >> syms x y g, u=x*exp(-(x^2+y^2)/g^2); v=y*exp(-(x^2+y^2)/g^2); > >> div=divergence(x,y,u,v) > ??? Error using ==> sym.double at 29 > DOUBLE cannot convert the input expression into a double array. > If the input expression contains a symbolic variable, use the VPA > function instead. > > Error in ==> divergence at 35 > u = double(u); a hint: - the error message is crystal clear: - DIVERGENCE does not deal with complicated symbolic objects, ie, expressions... - you must convert those into DOUBLE values before you call the function... us
From: Andrea on 31 Jul 2010 07:23 "Andrea " <none(a)hotmail.com> wrote in message <i30vce$hqd$1(a)fred.mathworks.com>... > I need to calculate divergence of a vector field, maybe Is the most stupid mistake ever made but I really need a solution > > >> syms x y g, u=x*exp(-(x^2+y^2)/g^2); v=y*exp(-(x^2+y^2)/g^2); > >> div=divergence(x,y,u,v) > ??? Error using ==> sym.double at 29 > DOUBLE cannot convert the input expression into a double array. > If the input expression contains a symbolic variable, use the VPA > function instead. > > Error in ==> divergence at 35 > u = double(u); ================= Perfect, I understand the message. The problem is how can I make that converssion??
From: Andrea on 31 Jul 2010 07:24 "us " <us(a)neurol.unizh.ch> wrote in message <i310hs$ue$1(a)fred.mathworks.com>... > "Andrea " <none(a)hotmail.com> wrote in message <i30vce$hqd$1(a)fred.mathworks.com>... > > I need to calculate divergence of a vector field, maybe Is the most stupid mistake ever made but I really need a solution > > > > >> syms x y g, u=x*exp(-(x^2+y^2)/g^2); v=y*exp(-(x^2+y^2)/g^2); > > >> div=divergence(x,y,u,v) > > ??? Error using ==> sym.double at 29 > > DOUBLE cannot convert the input expression into a double array. > > If the input expression contains a symbolic variable, use the VPA > > function instead. > > > > Error in ==> divergence at 35 > > u = double(u); > > a hint: > - the error message is crystal clear: > - DIVERGENCE does not deal with complicated symbolic objects, ie, expressions... > - you must convert those into DOUBLE values before you call the function... > > us ========== Perfect, I understand the message. The problem is how can I make that converssion?? Plz
From: Steven_Lord on 3 Aug 2010 14:37 "Andrea " <none(a)hotmail.com> wrote in message news:i3114j$7d1$1(a)fred.mathworks.com... > "us " <us(a)neurol.unizh.ch> wrote in message > <i310hs$ue$1(a)fred.mathworks.com>... >> "Andrea " <none(a)hotmail.com> wrote in message >> <i30vce$hqd$1(a)fred.mathworks.com>... >> > I need to calculate divergence of a vector field, maybe Is the most >> > stupid mistake ever made but I really need a solution >> > >> > >> syms x y g, u=x*exp(-(x^2+y^2)/g^2); v=y*exp(-(x^2+y^2)/g^2); >> > >> div=divergence(x,y,u,v) >> > ??? Error using ==> sym.double at 29 >> > DOUBLE cannot convert the input expression into a double array. >> > If the input expression contains a symbolic variable, use the VPA >> > function instead. >> > >> > Error in ==> divergence at 35 >> > u = double(u); >> >> a hint: >> - the error message is crystal clear: >> - DIVERGENCE does not deal with complicated symbolic objects, ie, >> expressions... >> - you must convert those into DOUBLE values before you call the >> function... >> >> us > > ========== > > > Perfect, I understand the message. The problem is how can I make that > converssion?? Plz Use SUBS to substitute numeric values into your symbolic expressions -- you may also need to use MESHGRID or BSXFUN to create u and v as gridded data. And in the future, please use a more specific subject line than simply "Error". Don't be afraid to use extra characters in the subject line (within reason) to explain what you're trying to do -- they're fairly cheap, even for those readers that still use dial-up. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: from x_guess to x_feedback Next: Plotting points at the max |