Plot 3D data from excel file (2024)

36 views (last 30 days)

Show older comments

vipul vibhanshu on 26 Jun 2024 at 9:38

  • Link

    Direct link to this question

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file

  • Link

    Direct link to this question

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file

Answered: Star Strider on 26 Jun 2024 at 11:26

  • Copy of data.xlsx

I am unable to plot the surface plot for the data from the excel sheet

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Answers (3)

Muskan on 26 Jun 2024 at 10:04

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477351

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477351

You can use the "surf" function in MATLAB to plot the surface plot. Please follow the following steps:

1) Prepare Your Excel File:

Ensure your Excel file is organized such that it represents a grid of Z values. The first row and first column can represent the X and Y coordinates, respectively.

2) Read Data from Excel File:

Use the readmatrix function to read the data from the Excel file into MATLAB.

3) Extract X, Y, and Z Data:

Extract the X, Y, and Z data from the matrix.

4) Plot the Surface:

Use the "surf" function to create a surface plot.

Refer to the following documentation of "surf" for a better understanding:

https://in.mathworks.com/help/matlab/ref/surf.html

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Pavan Sahith on 26 Jun 2024 at 10:31

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477376

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477376

Open in MATLAB Online

Hello Vipul,

I see that you're trying to generate a surface plot using data from your Excel file.

To achieve that in MATLAB , you can refer to the following sample code which will help,

% Load the data from the Excel sheet

data = readtable('data.xlsx');

% Extract the columns

Primary = data.Primary;

Auger = data.Auger;

Yield = data.Yield;

% Remove rows with NaN values in Yield

validIdx = ~isnan(Yield);

Primary = Primary(validIdx);

Auger = Auger(validIdx);

Yield = Yield(validIdx);

% Create a grid of unique Primary and Auger values

[PrimaryGrid, AugerGrid] = meshgrid(unique(Primary), unique(Auger));

% Interpolate Yield values onto the grid

YieldGrid = griddata(Primary, Auger, Yield, PrimaryGrid, AugerGrid);

% Create the surface plot

figure;

surf(PrimaryGrid, AugerGrid, YieldGrid);

xlabel('Primary');

ylabel('Auger');

zlabel('Yield');

title('Surface Plot of Yield');

colorbar; % Add a color bar to indicate the scale of Yield

This approach uses griddata to interpolate the Yield values onto the grid, ensuring that the surface plot is properly populated with data points.

The interpolation step using griddata is essential because it helps in creating a continuous surface from discrete data points.

Consider referring to the following MathWorks documentation to get a better understanding

  • griddata - https://www.mathworks.com/help/matlab/ref/griddata.html
  • meshgrid- https://www.mathworks.com/help/matlab/ref/meshgrid.html
  • surf- https://www.mathworks.com/help/matlab/ref/surf.html

Hope this helps you in moving ahead

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Star Strider on 26 Jun 2024 at 11:26

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477426

  • Link

    Direct link to this answer

    https://ms-intl.mathworks.com/matlabcentral/answers/2132126-plot-3d-data-from-excel-file#answer_1477426

Open in MATLAB Online

  • Copy of data.xlsx

Use the scatteredInterpolant function to create the surface.

Using the provided data —

T1 = readtable('Copy of data.xlsx')

T1 = 21x3 table

Primary Auger Yield _______ _____ _____ 2000 950 NaN 2500 530 27.5 2000 530 34.81 2000 530 18.9 2700 590 21.7 2800 580 17.5 4000 750 18.4 4000 950 25.7 4000 950 24 4100 950 NaN 2500 700 23.2 4000 950 NaN 4000 950 NaN 4000 950 23.8 4300 900 27.5 2500 400 25.5

VN = T1.Properties.VariableNames;

x = T1.Primary;

y = T1.Auger;

z = T1.Yield;

figure

stem3(x, y, z)

hold on

scatter3(x, y, z, 50, z, 'filled')

hold off

colormap(turbo)

colorbar

xlabel(VN{1})

ylabel(VN{2})

zlabel(VN{3})

axis('padded')

title('Stem - Scatter Plot Of Original Data')

Plot 3D data from excel file (5)

xv = linspace(min(x), max(x), 50);

yv = linspace(min(y), max(y), 50);

[X,Y] = ndgrid(xv, yv);

F = scatteredInterpolant(x, y, z);

Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.

Z = F(X,Y);

figure

surfc(X, Y, Z)

colormap(turbo)

colorbar

xlabel(VN{1})

ylabel(VN{2})

zlabel(VN{3})

% axis('padded')

title('Surface Plot Of Original Data')

Plot 3D data from excel file (6)

Interpolatting the missing data yields this result —

T1 = fillmissing(T1, 'linear')

T1 = 21x3 table

Primary Auger Yield _______ _____ _____ 2000 950 20.19 2500 530 27.5 2000 530 34.81 2000 530 18.9 2700 590 21.7 2800 580 17.5 4000 750 18.4 4000 950 25.7 4000 950 24 4100 950 23.6 2500 700 23.2 4000 950 23.4 4000 950 23.6 4000 950 23.8 4300 900 27.5 2500 400 25.5

VN = T1.Properties.VariableNames;

x = T1.Primary;

y = T1.Auger;

z = T1.Yield;

figure

stem3(x, y, z)

hold on

scatter3(x, y, z, 50, z, 'filled')

hold off

colormap(turbo)

colorbar

xlabel(VN{1})

ylabel(VN{2})

zlabel(VN{3})

axis('padded')

title('Stem - Scatter Plot Of Interpolated (‘Filled’) Data')

Plot 3D data from excel file (7)

xv = linspace(min(x), max(x), 50);

yv = linspace(min(y), max(y), 50);

[X,Y] = ndgrid(xv, yv);

F = scatteredInterpolant(x, y, z);

Warning: Duplicate data points have been detected and removed - corresponding values have been averaged.

Z = F(X,Y);

figure

surfc(X, Y, Z)

colormap(turbo)

colorbar

xlabel(VN{1})

ylabel(VN{2})

zlabel(VN{3})

% axis('padded')

title('Surface Plot Of Interpolated (‘Filled’) Data')

Plot 3D data from excel file (8)

I am assuming that you want them plotted in this order. If not, change the original assignments for ‘x’, ‘y’ and ‘z’, in both sections (‘Original’ and ‘Interpoalted’). My code should adapt automatically to those changes.

.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABGraphics2-D and 3-D PlotsSurfaces, Volumes, and PolygonsSurface and Mesh Plots

Find more on Surface and Mesh Plots in Help Center and File Exchange

Tags

  • plotting
  • 3d plots
  • surface plot

Products

  • MATLAB

Release

R2024a

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


Plot 3D data from excel file (9)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Plot 3D data from excel file (2024)

FAQs

Plot 3D data from excel file? ›

Step-by-Step: 3D Excel Chart

On the Insert tab, choose the Column dropdown in the Charts You can now choose a 3D chart type for your Summary data. This example shows the 3D Column chart type, but there are many 3D Excel charts to choose from. Choose the best for your data and audience!

How do you plot 3D data in Excel? ›

How to Create a 3D Plot in Excel?
  1. Let us pick some random data first, like the one below. ...
  2. Select the data we want to plot the 3D chart.
  3. Click on the surface chart in the “Insert” tab under the “Charts” section.
  4. Excel's typical 3D surface plot appears below, but we cannot read much from this chart.
Apr 29, 2024

How do you show 3 dimensional data in Excel? ›

Step-by-Step: 3D Excel Chart

On the Insert tab, choose the Column dropdown in the Charts You can now choose a 3D chart type for your Summary data. This example shows the 3D Column chart type, but there are many 3D Excel charts to choose from. Choose the best for your data and audience!

Can Excel do 3D scatter plots? ›

The 3D scatter plot chart in Excel is mainly used to show the relationship between two sets of data related to each other. The scattered chart has X and Y variables. This chart helps show related data like rainfall vs. umbrellas sold, rainfall vs.

Does Excel have 3D charts? ›

You can also click the See all charts icon in the lower right of the Charts section. This opens the Chart dialog, where you can pick any chart type. Each category usually show both 2D and 3D. Choose one.

How do I plot 3 data in Excel? ›

Step 1: Open the Excel sheet, enter the values of three columns and save the columns with names. Step 2: Select everything, including headers, and open the insert tab in the navigation menu. Step 3: Navigate to the charts session and click on line graphs.

How do you make a 3D effect in Excel? ›

In Word, Excel, PowerPoint, or Outlook:
  1. Select Insert > 3D Models.
  2. Select From Online Sources.
  3. Search for what you want and select Insert.

How do you Visualise 3 dimensional data? ›

For visualizing three-dimensional data we can take advantage of our visual system's ability to reconstruct three dimensional scenes from two-dimensional images using:
  1. perspective rendering, lighting, and shading;
  2. motion with animation and interaction;
  3. stereo viewing methods.

How do you make a 3D model in Excel? ›

On the Insert tab of the ribbon select 3D Models and then From a File. Use the 3D control to rotate or tilt your 3D model in any direction. Just click, hold and drag with your mouse. Drag the image handles in or out to make your image larger or smaller.

How to do 3D calculations in Excel? ›

Skill Refresher
  1. Click on the cell where you want the 3-D SUM to appear.
  2. Type =SUM(
  3. Click on the leftmost sheet in the group of sheets you want to sum.
  4. Hold the SHIFT key down and click on the rightmost sheet in the group of sheets you want to sum.
  5. Click on the cell in the sheet you're in that you want to sum.

How do you plot 3 dimensional data in Excel? ›

Select the data that you want to use for your 3D plot. Go to the "Insert" tab in the Excel ribbon and select the desired chart type under the "Charts" section. Choose the 3D plot option that best fits your needs. Customize your chart by adding titles and labels and adjusting the appearance of the plot.

How do I make a 3D data table in Excel? ›

How to Create a Three-Dimensional Table in Excel
  1. Step 1: Enter the Data for Each Table. ...
  2. Step 2: Add Camera Tool to Quick Access Toolbar. ...
  3. Step 3: Use Camera Tool to Create Floating Tables. ...
  4. Step 4: Rotate Tables to Create Three-Dimensional Table.
Aug 22, 2023

How to draw a 3D box in Excel? ›

How can I create a 3D plot in Excel?
  1. Prepare and select your data.
  2. Click Insert Tab and click the 3D map option.
  3. Select a 3d MapPut in your visual data.
  4. Customize your 3d map.
Mar 21, 2023

How to make a 3D box in Excel? ›

How can I create a 3D plot in Excel?
  1. Prepare and select your data.
  2. Click Insert Tab and click the 3D map option.
  3. Select a 3d MapPut in your visual data.
  4. Customize your 3d map.
Mar 21, 2023

Top Articles
The Best Social Media Site Still Looks Like It Was Made in the 1990s
'The Greatest Social Media Site Is Craigslist' - Slashdot
This website is unavailable in your location. – WSB-TV Channel 2 - Atlanta
Hotels Near 625 Smith Avenue Nashville Tn 37203
Inducement Small Bribe
Violent Night Showtimes Near Amc Fashion Valley 18
Cvs Devoted Catalog
Truist Drive Through Hours
Lantana Blocc Compton Crips
Clairememory Scam
Detroit Lions 50 50
Jasmine Put A Ring On It Age
Keniakoop
A rough Sunday for some of the NFL's best teams in 2023 led to the three biggest upsets: Analysis - NFL
Guilford County | NCpedia
Apus.edu Login
Check From Po Box 1111 Charlotte Nc 28201
Pizza Hut In Dinuba
Adam4Adam Discount Codes
Vandymania Com Forums
Welcome to GradeBook
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Evil Dead Rise Showtimes Near Regal Sawgrass & Imax
Pearson Correlation Coefficient
Mybiglots Net Associates
Plaza Bonita Sycuan Bus Schedule
Ecampus Scps Login
Jeff Nippard Push Pull Program Pdf
Integer Division Matlab
Apartments / Housing For Rent near Lake Placid, FL - craigslist
Jamielizzz Leaked
Till The End Of The Moon Ep 13 Eng Sub
Barbie Showtimes Near Lucas Cinemas Albertville
Lininii
Www.craigslist.com Syracuse Ny
Roch Hodech Nissan 2023
Shaman's Path Puzzle
Vitals, jeden Tag besser | Vitals Nahrungsergänzungsmittel
Bismarck Mandan Mugshots
Michael Jordan: A timeline of the NBA legend
Craigslist Ludington Michigan
Final Fantasy 7 Remake Nexus
Guy Ritchie's The Covenant Showtimes Near Grand Theatres - Bismarck
Subdomain Finder
Thotsbook Com
The Quiet Girl Showtimes Near Landmark Plaza Frontenac
Dineren en overnachten in Boutique Hotel The Church in Arnhem - Priya Loves Food & Travel
Strange World Showtimes Near Atlas Cinemas Great Lakes Stadium 16
Diamond Desires Nyc
Strawberry Lake Nd Cabins For Sale
Uno Grade Scale
2000 Fortnite Symbols
Latest Posts
Article information

Author: Nicola Considine CPA

Last Updated:

Views: 6043

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Nicola Considine CPA

Birthday: 1993-02-26

Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

Phone: +2681424145499

Job: Government Technician

Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.