필터 지우기
필터 지우기

Import values having different units in matlab

조회 수: 2 (최근 30일)
Anshul Jain
Anshul Jain 2021년 12월 8일
답변: Mrinal Anand 2023년 7월 8일
Dear sir,
I have three parameters Ez, Bx and By with some finite values of each of them.
Ez is in "mm" while Bx and By are in "degree".
I want to plot volume plot between them as a 3-D plot. (though they have different units)
I am using the following code for that and getting a 3-D plot:
T = readtable('New12.xlsx', 'Sheet',1, 'Range','A2:C35');
T = table2array(T);
Ez=T(:,1);
Bx=T(:,2);
By=T(:,3);
plot3(Ez,Bx,By,'.');
kkk=boundary(Bx,By,Ez);
trisurf(kkk,Bx,By,Ez,'Facecolor','r');
xlabel('Bx(deg)');
ylabel('By(deg)');
zlabel('Ez(mm)');
Now, my concern is : Ez is in 'mm ' and Bx and By are in degree, but the plot I am getting will be in cartesian cordinate..? (Sorry, I am not aware but my anticipation is that the Matlab uses cartesian coordinate system to plot, until unless specified).
The values of Bx and By are in degrees but how does this code will know that they are in degrees? It might considering their values in "mm" only if MATLAB uses cartesian coordinate system.
So, please let me know how to make understand the code that two values are in degrees and one in mm? or how to import the degree values in matlab? (since I am directly importing them just like Ez which is in mm).
Please resolve my issue.
An excel file is attached here for the reference.
Thanks and regards,
Anshul Jain

답변 (1개)

Mrinal Anand
Mrinal Anand 2023년 7월 8일
Matlab plotting functions assume that the plotting data is given in Cartesian coordinates by default. So you need to convert your angle data to Radians before plotting. Here are the modifications you should make to your code:
Bx_rad = deg2rad(Bx_deg);
By_rad = deg2rad(By_deg);
Your code should then plot the correct figure.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by