Re: vector magnitude [message #39561 is a reply to message #39463] |
Mon, 24 May 2004 23:55  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <e920fce6.0405241938.6e4dd6d6@posting.google.com>, "elias"
<heoa@hotmail.com> wrote:
> Hi!
> I would like to use GRID3 in my program. For that, I have to use an
> array "F" that includes the values associated with a location in the
> space. I don't have this F array yet. I have to calculate it, as the
> square root of the summation of the velocity components to the square
> power each.
> - Can IDL do this calculations or should I do them in a different
> software and bring them ready into IDL? Thank you!
> Elias
Hi,
If you want to calculate the square of a variable
square=variable^2
will do it, for your velocity amplitude (which is what you are
calculating...)
amp=sqrt(u^2+v^2+w^2)
should 'work'. u,v,w are the velocity vectors, they should be the same
size and shape (for your sanity, if nothing else).
How you get the velocity data into your program is up to you, at some
point you'll need to READF it in, unless it's in a format supported by
IDL (NetCDF, CDF,HDF,HDF5 etc...) then you should use the library
functions to read the data.
Then it's
data_3d=grid3(x,y,z,amp)
and your 3d dataset is made
Chris.
|
|
|