如何分割图形
一般问题
发布于 2024-12-24 23:52:37
查看 25过去551天
在一个边长为3的正方形分成9等分,并在每份中着不同颜色,如何用Mworks进行这个操作
所属专栏:Syslab基础平台
产品信息:函数库-基础数学工具箱
在一个边长为3的正方形分成9等分,并在每份中着不同颜色,如何用Mworks进行这个操作
using TyPlot
width=3;
height=3;
figure;
rectangle(position=[0 0 width height])
colors=parula(width*height);
for i=1:height
for j=1:width
rectangle(position=[j-1 i-1 1 1],facecolor=colors[i*j,:]);
end
end
using TyPlot
width=3;
height=3;
figure;
rectangle(position=[0 0 width height])
colors=parula(width*height);
for i=1:height
for j=1:width
rectangle(position=[j-1 i-1 1 1],facecolor=colors[i*j,:]);
end
end