![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/558397/image.png)
How to create a grid of squares and attribute a color to the squares like in a contour plot?
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to reproduce the plots from a paper called "Fundamentals for Energy-Efficient Massive MIMO" where the author creates a 8x16 grid and gives temperature values for the contours like you can see here. The only "required" plot is (a), but it should be easy to reproduce (b) once (a) is done.
The problem is where to start with this. Can someone please point me directions?
0 个评论
回答(1 个)
darova
2021-3-22
Here is the idea
clc,clear
t = linspace(0,360,5)+45; % create angles
t = [t-2 t+2]; % add shifted angles
t1 = sort(t); % sorting
[x,y] = pol2cart(t1*pi/180,1); % convert to cartesian
x(x>0) = x(x>0) + 1; % move right part to right
x(x<0) = x(x<0) - 1; % move left part to left
% create surface
X = [x/10; x];
Y = [y/10; y];
Z = [x*0+1; x*0];
contour3(X,Y,Z,0:0.2:1)
surface(X,Y,Z)
view(45,45)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/558397/image.png)
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!