Filter löschen
Filter löschen

Converting cylindircal data into regular cartesian grid

3 Ansichten (letzte 30 Tage)
BHARAT SINGH
BHARAT SINGH am 21 Jun. 2023
Kommentiert: Richard Burnside am 21 Jun. 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

Antworten (1)

Richard Burnside
Richard Burnside am 21 Jun. 2023
Bearbeitet: Richard Burnside am 21 Jun. 2023
Bharat,
Have you looked at the pol2cart function? I think it should work for you here.
  2 Kommentare
BHARAT SINGH
BHARAT SINGH am 21 Jun. 2023
yes I did. But how should I reshape the arrays because they are not same size.
Richard Burnside
Richard Burnside am 21 Jun. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by