How can I do contour plot from set of data from .xlsx?
1 次查看(过去 30 天)
显示 更早的评论
I get this code from this website http://linuxrajib.blogspot.com/2012/04/2d-contour-plot-in-matlab.html but I don't know how to do with it. I want to do contour plot like this in my .xlsx file. (.xlsx file in the attachment)
clear all;
close all;
L1 = load('dataset1.dat');
N1=6;
N2=220;
k = 1;
for i = 1 : 1 : N1
for j = 1 : 1: N2
k = (i - 1) * N2 + j;
X1(j,i) = L1(k, 1);
Y1(j,i) = L1(k, 2);
Z1(j,i) = L1(k, 3);
end
end
contourf(X1, Y1, Z1);
lighting gouraud
xlim([0.0 0.6])
ylim([0.04 0.09])
set(gca, 'xtick', 0.0:0.1:0.6,'Fontsize', 15)
set(gca, 'ytick', 0.04:0.01:0.09,'Fontsize', 15)
xlabel('xlabel text','Fontsize', 20);
ylabel('ylabel text','FontSize', 20);

0 个评论
回答(1 个)
Jacob Mathew
2025-1-3
Hey Nanthanon,
You can refer to the following documentation to understand how to load spreadsheets into MATLAB:
https://www.mathworks.com/help/releases/R2024b/matlab/import_export/ways-to-import-spreadsheets.html
Once you have the required data from the spreadsheet, refer to the following documentation to create contour plots:
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Contour Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!