Converting cylindircal data into regular cartesian grid
이전 댓글 표시
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
답변 (1개)
Richard Burnside
2023년 6월 21일
편집: Richard Burnside
2023년 6월 21일
0 개 추천
Bharat,
Have you looked at the pol2cart function? I think it should work for you here.
댓글 수: 2
BHARAT SINGH
2023년 6월 21일
Richard Burnside
2023년 6월 21일
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.
카테고리
도움말 센터 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!