creating a 2D physical coordinates matrix from 1D flux coordinate array

9 views (last 30 days)
Hi everyone, i'm pretty new to the MATLAB world and i'm having some troubles finding solutions to my problem, i hope some of you guys can help me solve this
i will describe you first the context and then explain my issues
so i have two different datasets, describing two parameters of a fusion reactor plasma as a function of their position
1) the first data set is a matrix 65x40 containing the values (magnetic field) as a function of two physical coordinates, a radial one R (going from 0.75 to 2.67 m in 40 discrete points) and a vertical one Z (going from -1.5 to +1.5 in 65 discrete points)
2) the second data set contains the values of the other parameter (density), as function of a flux coordinate. The flux coordinate is defined as 0 at the center of the plasma and equal to 1 at the last closed magnetic surface. every value of rho identifies the contour of a surface on the poloidal plane (the cross section of a donut shaped reactor).
now, for my calculation i need to express the second data set as a function of the physical coordinates grid. I also have the transformation matrix: it contains the values of rho as a function of the Z and R coordinates. now my problems are:
the values expressed in the RHO 1D array don't exactly correspond the ones found in the transform matrix (eg i got 0.95 rho in the 1D array, and values around 0.95454, 0.943233 etc. in the matrix): i need to work on a "closest value" basis when extracting the values from the transformation matrix. In that way i can assign to each value of the density a set of points on the physical grid, composing the surface contour identified by the starting rho. From those values, i need to build the density matrix
i hope i was clear enough with my exposition...it can be difficult to translate mathematics and physics to human language, sometimes :D

Answers (2)

KSSV
KSSV on 21 Nov 2016
Let R,Z be your radial and vertical data which are 40, 65 dimension arrays respectively. Let D be your field matrix of size 65*40.
[Rg,Zg]=meshgrid(R,Z);
surf(Rg,Zg,D) ;
colorbar

Bruccio
Bruccio on 21 Nov 2016
Edited: Bruccio on 21 Nov 2016
Thanks for the answer...but that really doesn't solve my problems. with the code you gave me i generate a 3d surface plot whose z are the values of rho, R and Z as x and y...what i need is to associate to every single value i have for RHO (40 points) a set of coordinates (R,Z) that identify the points on the surfaces generated by that same rho value. i attached to this answer a plot taken from the internet that contains the magnetic surfaces profiles inside a tokamak. every profile line is generated by one value of rho (eg the line with 0.5 written on it is the line corresponding to, you may have guessed, a rho = 0.5) and is composed by a moltitude of points P_n with coordinates (R_n, Z_n). Hope this clarifies.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!