Surf plot from excel file
3 views (last 30 days)
Show older comments
I am unsure on how to get this to upload to produce a surface plot. I have seen similar code such as the below but am unsure on how to convert this to function with mine
clc
clear all
T = readmatrix('C:\Users\natha\Downloads')
x = T(:,1)
y = T(:,2)
z = T(:,3)
[X,Y]=meshgrid(x,y)
surf(X,Y,z)
xlabel('X')
ylabel('Y')
zlabel('IDT Resonant Frequency')
0 Comments
Answers (1)
Star Strider
on 8 Mar 2024
It would help to know what the data are, and what you want to do with the NaN values.
That aside, just plot all but the first column as a matrix —
A1 = readmatrix('IDT results.xlsx')
figure
surfc(A1(:,2:end))
colormap(turbo)
xlabel('X')
ylabel('Y')
An alternative approach would be to create ‘x’ and ‘y’ vectors or lengths 17 and 9 and then use that with meshgrid or ndgrid to create (17x9) matrices to use with the scatteredInterpolant function.and the last 9 columns of the matrix (all reshaped to produce column vectors) to create an interpolated matrix.
.
0 Comments
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!