
How to plot hexagonal boundary graph
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
changmin lim
le 18 Jan 2024
Commenté : changmin lim
le 18 Jan 2024
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 commentaires
Réponse acceptée
Kyoung Moon Lee
le 18 Jan 2024
Modifié(e) : Kyoung Moon Lee
le 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

Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!