Shifting an array of values from one position to another
2 次查看(过去 30 天)
显示 更早的评论
Hi,
Here I am adding a Matlab code which generates an array of 2x2 circular images (dim 64x64) which here I am considering to be at position A (having strips).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% m1=3;m2=6;
a=64; b=64;
[x,y]=meshgrid(-1:2/63:+1, -1:2/63:+1); circ=sqrt(x.^2+y.^2)<1;
% Generation Of Holograms
h1=circ.*(cos((x*pi*m1)+(y*pi*m1)))>0; h2=circ.*(cos((x*pi*m1)+(y*pi*m2)))>0; h3=circ.*(cos((x*pi*m2)+(y*pi*m1)))>0; h4=circ.*(cos((x*pi*m2)+(y*pi*m2)))>0;
% Placing of Holograms H=zeros(256,256); H(1:a, 1:b) = h1; %M(1, 1) H(1:a, 2*b+1:b*3) = h2; %M(2, 1)
H(2*a+1:a*3, 1:b) = h3;%M(1, 2) H(2*a+1:a*3, 2*b+1:b*3) = h4; %M(2, 2)
figure(1) imagesc(H); colormap gray; axis image; axis off
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My problem:
1. Next, I want to move these images to position B(red) and then to C (blue) and finally to position D (yellow). 2. I wish if I could visualize this movement with a certain time lapse.
Could anyone please help me to implement this in Matlab?
Thanking you in anticipation.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/153865/image.png)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!