How to Create a Surface Plot from Table Data Imported from Excel
48 views (last 30 days)
Michaela Byrne on 3 Mar 2022
I am trying to create a surface plot for the excel table shown in the image below using the "surf" function. TetherK and TetherC are my inputs. Power is my output (the white cells). I can't seem to get the surf fucntion to work. I imported the data and have a table in MATLAB for TetherK, TetherC, and my Output (shown below). What do I need to do so that I can make a surface plot from tables in MATLAB?
Scott MacKenzie on 3 Mar 2022
Edited: Scott MacKenzie on 3 Mar 2022
Given some test data (attached) similar to yours...
... a surface plot can be created thus...
M = readmatrix('testdata.xlsx');
[X,Y] = meshgrid(M(1,2:end),M(2:end,1));
Z = M(2:end,2:end);
The test data are random values. Hopefully, your plot will look more interesting.