Azzera filtri
Azzera filtri

Import values having different units in matlab

1 visualizzazione (ultimi 30 giorni)
Anshul Jain
Anshul Jain il 8 Dic 2021
Risposto: Mrinal Anand il 8 Lug 2023
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);
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

Risposte (1)

Mrinal Anand
Mrinal Anand il 8 Lug 2023
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.


Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange


Community Treasure Hunt

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

Start Hunting!

Translated by