Making tilted and rotated periodic 2D arrays
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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]);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/962085/image.png)
With this, I want to make m by n copied array as below.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/962090/image.png)
Could you give me some help?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Language Fundamentals 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!