Making tilted and rotated periodic 2D arrays

1 次查看(过去 30 天)
I'm studying DMD(digital micromirror device) mirror.
I made the tilted rhombic(45 degrees rotated square around the Z-axis) 2D arrays with rect function.
function[out] = rect(x);
out = abs(x)<=1/2;
end
clc; clear all; close all;
##
wx=0.9; %rect x half-width (m)
wy=0.9; %rect y half-width (m)
L=1; %side length x&y (m)
M=100; %samples/side length
dx=L/M; %sample interval (m)
x=-L/2:dx:L/2-dx; %x coordinates
y=x; %y coordinates
[X,Y]=meshgrid(x,y); %X and Y grid coords
DMDshape=rect(X/wx).*rect(Y/wy); %signal
##
Xlist = reshape(X,1,M^2);
Ylist = reshape(Y,1,M^2);
Zlist = reshape(DMDshape-1,1,M^2);
##
ListSet = [Xlist; Ylist; Zlist];
RotListSet =rotx(12)* rotz(45)*ListSet;
plot3(ListSet(1,:),ListSet(2,:),ListSet(3,:),'.b');
axis tight
hold on
plot3(RotListSet(1,:),RotListSet(2,:),RotListSet(3,:),'.r');
axis([-1, 1, -1, 1, -0.5, 0.5]);
(one cell)
With this, I want to make m by n copied array as below.
(cell arrays)
Could you give me some help?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Language Fundamentals 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by