Converting cylindircal data into regular cartesian grid

1 visualización (últimos 30 días)
BHARAT SINGH
BHARAT SINGH el 21 de Jun. de 2023
Comentada: Richard Burnside el 21 de Jun. de 2023
I have 4 csv files as follows
FieldMap_Bz.csv is a 301x501 data file containing Bz magnetic field values
FieldMap_Br.csv is a 301x501 data file containing Br magnetic field values
FieldMap_z.csv is a 1x501 file containing Z cordinates
FieldMap_r.csv is a 1x301 file containing R cordinates
there is no variation in theta so it can be assumed zero.
I want to get a output in the form of (X,Y,Z,BX,BY,BZ) in a tabular form.Below is my code. However I am not able to figure out a way to make the meshgrid same size for both directions
clc;
clear all;
close all;
Br=importdata('FieldMap_Bz.csv');%%Radial Magnetic field values
Bz=importdata('FieldMap_Br.csv');%%Axial Magnetic field values
Z=importdata('FieldMap_z.csv');
Radial=importdata('FieldMap_r.csv');
R=Radial(:,1);%%Radial Cordinates
Z=Z(1,:);%%Axial Cordinates
theta=0;
X=Radial*cos(theta);
Y=Radial*sin(theta);
Z=Z;
Bx=Br*cos(theta);
By=Br*sin(theta);
Bz=Bz;
I look forward to everyones suggestion and help.
thanks
Bharat

Respuestas (1)

Richard Burnside
Richard Burnside el 21 de Jun. de 2023
Editada: Richard Burnside el 21 de Jun. de 2023
Bharat,
Have you looked at the pol2cart function? I think it should work for you here.
  2 comentarios
BHARAT SINGH
BHARAT SINGH el 21 de Jun. de 2023
yes I did. But how should I reshape the arrays because they are not same size.
Richard Burnside
Richard Burnside el 21 de Jun. de 2023
FieldMap_Bz.csv is a 301x501 data file containing Bz magnetic field values
FieldMap_Br.csv is a 301x501 data file containing Br magnetic field values
FieldMap_z.csv is a 1x501 file containing Z cordinates
FieldMap_r.csv is a 1x301 file containing R cordinates
and theta is assumed to be zero.
Hmm...
Its hard to say how to stitch this data together without seeing it. Its a planar slice of a cylinder so possibly it is 301 r coordinates and 501 z coordinates with orthogonal B-field vectors at each (r,z) coordinate pair.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by