From: Andrea on
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
"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
"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
"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


"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