![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593816/image.png)
How to plot hexagonal boundary graph
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
changmin lim
am 18 Jan. 2024
Kommentiert: changmin lim
am 18 Jan. 2024
Hello, I am currently studying on plotting the graph. And I am trying to plot hexagonal graph shown in the attachment.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593741/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593741/image.png)
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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593746/image.png)
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 Kommentare
Akzeptierte Antwort
Kyoung Moon Lee
am 18 Jan. 2024
Bearbeitet: Kyoung Moon Lee
am 18 Jan. 2024
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1593816/image.png)
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Directed Graphs finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!