How to plot a 2d contour using 3d source of data (measured and recorded within a spreadsheet)
Show older comments
Hi there,
It would be my greatest pleasure if anyone could assist me with plotting a 2d contour from the attached data (derived from an experiment and stored within a Excel file). It would be so much appreciated if you could do me a favor and include all the MATLAB required scriptting. Thanks!
Accepted Answer
More Answers (1)
Walter Roberson
on 22 Mar 2021
Edited: Walter Roberson
on 22 Mar 2021
t = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/557822/Sample.xlsx', 'VariableNamingRule', 'preserve');
N = 50;
x = t{:,1};
y = t{:,2};
irrad = t{:,3};
xvec = linspace(min(x), max(x), N);
yvec = linspace(min(y), max(y), N);
[Xg, Yg] = meshgrid(xvec, yvec);
F = scatteredInterpolant(x, y, irrad);
Ig = F(Xg, Yg);
contourf(Xg, Yg, Ig); colorbar
Categories
Find more on Contour Plots 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!
