Plot 3D surface from Excel .csv File

65 views (last 30 days)
Sarah D
Sarah D on 29 Aug 2021
Commented: Sarah D on 29 Aug 2021
Hello,
I am trying to plot 3D surface from the attached excel csv file (data.csv).
I want the surface to be smooth if possible.
  • x = first column;
  • y = second column;
  • z = third column.
I am new to Matlab and I have been struggling to do it. Could you please help me?
Also, how could I annotate the minumum of the surface and its x and y coordinates as well.
Thanks a lot!
-

Accepted Answer

Simon Chan
Simon Chan on 29 Aug 2021
You may extract the data using function readmatrix.
clear; clc;
rawdata = readmatrix('data.csv');
x = reshape(rawdata(:,1),[],51); % Reshape the column matrix into 51 columns
y = reshape(rawdata(:,2),[],51);
z = reshape(rawdata(:,3),[],51);
surf(x,y,z)
result as follows:
  5 Comments
Sarah D
Sarah D on 29 Aug 2021
I really appreciate. I got a better understanding of how Matlab works from your answers as well. Thanks!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by