How to build a 3d map from raw data?

3 views (last 30 days)
Junxian Wu
Junxian Wu on 6 Aug 2022
Answered: Karim on 8 Aug 2022
Please help me, this is very important to me.
My original plot is as follows, with voltage and current on the x and y axes respectively, and different temperatures in the legend
but I would like to change it to a 3D plot,as follows from right to left.

Answers (1)

Karim
Karim on 8 Aug 2022
If you want to plot the curves in 3D, you can use the plot3 command. See below for an example:
% read the data
opts = spreadsheetImportOptions("NumVariables", 16);
opts.Sheet = "Sheet1";
opts.DataRange = "B4:Q151";
opts.VariableNames = ["VoltageV0", "CurrentA0", "VoltageV1", "CurrentA1", "VoltageV2", "CurrentA2", "VoltageV3", "CurrentA3", "VoltageV4", "CurrentA4", "VoltageV5", "CurrentA5", "VoltageV6", "CurrentA6", "VoltageV7", "CurrentA7"];
opts.VariableTypes = ["double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double", "double"];
IVTCurve = readtable("IVT_Curve.xlsx", opts, "UseExcel", false);
% define the T data
T_Z_axis = [0.88 1 1.1 2 3 4 6 6.89];
% create the figure
figure
hold on
plot3( IVTCurve.VoltageV0, T_Z_axis(1)*ones(numel(IVTCurve.VoltageV0),1), IVTCurve.CurrentA0 )
plot3( IVTCurve.VoltageV1, T_Z_axis(2)*ones(numel(IVTCurve.VoltageV1),1), IVTCurve.CurrentA1 )
plot3( IVTCurve.VoltageV2, T_Z_axis(3)*ones(numel(IVTCurve.VoltageV2),1), IVTCurve.CurrentA2 )
plot3( IVTCurve.VoltageV3, T_Z_axis(4)*ones(numel(IVTCurve.VoltageV3),1), IVTCurve.CurrentA3 )
plot3( IVTCurve.VoltageV4, T_Z_axis(5)*ones(numel(IVTCurve.VoltageV4),1), IVTCurve.CurrentA4 )
plot3( IVTCurve.VoltageV5, T_Z_axis(6)*ones(numel(IVTCurve.VoltageV5),1), IVTCurve.CurrentA5 )
plot3( IVTCurve.VoltageV6, T_Z_axis(7)*ones(numel(IVTCurve.VoltageV6),1), IVTCurve.CurrentA6 )
plot3( IVTCurve.VoltageV7, T_Z_axis(8)*ones(numel(IVTCurve.VoltageV7),1), IVTCurve.CurrentA7 )
hold off
xlabel('Voltage [V]')
ylabel('T [K]')
zlabel('Current [µA]')
grid on
view([200 20])

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by