"Andrew" <joeblow@aol.com> wrote in message <gr1g9h$hba$1@fred.mathworks.com>...
> The documentation about divergence and curl is unclear (to me) about what values, and even functions, these operations are evaluated at. For example when I use this code:
>
> x=3:.1:3;y=3:.1:3;
> z=exp((x.^2+y.^2));
> [X Y]=meshgrid(x.*z,y.*z);
> [U V]=randn(61,61);
> div=divergence[X,Y,U,V]
>
> I get a set of values for the variable "div" that I assume is the divergence of something, but I can't tell what. Then, I change the values of U and V to:
>
> [U V]=meshgrid(x,y);
> div=divergence[X,Y,U,V]
>
> I get a different set of values. However, neither of these evaluates the divergence of the vector function [X Y] at the point indicated in [U V]. Is not this what this command is supposed to do? Does anybody know the proper syntax?
>
> Thank You for Responding:
>
> Andrew Stallard
I would suggest a thorough rereading of the 'divergence' function documentation, as well as that of 'randn'. You seem to have misinterpreted them rather badly.
1. Your U, V function matrices are wildly discontinuous if they come from 'randn' and partial derivatives of them would be meaningless.
2. My guess is you expected 'randn' to give you a smooth twodimensional bellshaped surface. It does no such thing.
3. The syntax of "[U V]=randn(61,61);" is wrong and should give errors.
4. You are possibly confusing the field values for the dependent variables in your second example. X & Y are the points and U & V the field values there.
5. Your X, Y matrices are not monotonic, contrary to requirements.
Roger Stafford
