
How to plot hexagonal boundary graph
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I am currently studying on plotting the graph. And I am trying to plot hexagonal graph shown in the attachment.

However when I extracted the results into txt file and put in the matlab, the results was shown like following attachment
file = readtable('wignertxt_111_5e20.xlsx');
x=table2array(file(:,1));
y=table2array(file(:,2));
z=table2array(file(:,3));
kA = reshape(x,379,7);
kB = reshape(y,379,7);
T = reshape(z,379,7);
%[X,Y,Z] = meshgrid(kA,kB,T);
%shading interp;
surf(kA, kB, T)
view(2)

the below Excel file is the txt file from the 1st picture attachment.
Can anyone please help me with this issues?
It would be a great help.
Thank you for reading.
0 件のコメント
採用された回答
Kyoung Moon Lee
2024 年 1 月 18 日
編集済み: Kyoung Moon Lee
2024 年 1 月 18 日
In order to create a contour graph in matlab, we need to convert to nXn data instead of 1xn.
clc; clear; close all;
% option control
op.resolution = 1000;
% read data
data = readmatrix('wignertxt_111_5e20.xlsx');
x = data(:,1);
y = data(:,2);
z = data(:,3);
% make grid
x1 = linspace(min(x),max(x),op.resolution);
y1 = linspace(min(y),max(y),op.resolution);
% interpolation
[x2,y2] = meshgrid(x1,y1);
z2 = griddata(x,y,z,x2,y2);
% figure
contourf(x2,y2,z2,'LineStyle','none')
colorbar

その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!