-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimateDots.m
49 lines (43 loc) · 1.08 KB
/
animateDots.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
fprintf('Animating %d timepoints... ', sp.Nt);
doQuiver = 0;
%% Normalize S
%Ms = sp.P(1);
Ms = 1;
mz = squeeze(S(3,:,:,:)) / Ms;
if doQuiver
mx = squeeze(S(1,:,:,:)) / Ms;
my = squeeze(S(2,:,:,:)) / Ms;
end
clf;
if doQuiver
subplot(121);
end
ih = pcolor(mz(:,:,1));
shading flat;
%ih = imagesc(mz(:,:,1), [-1 1]);
%ih = imagesc(mz(:,:,1));
axis equal;
axis ij;
axis([1 sp.Nx 1 sp.Ny]);
ith = title('m_z(n = 0)');
colormap('jet');
% colormap('jet');
colorbar;
if doQuiver
subplot(122);
[X Y] = meshgrid([1:sp.Nx],[1:sp.Ny]); Z = zeros(size(X)); surf(X,Y,Z, 'facealpha',0.5, 'edgealpha',0); hold on;
axis ij; axis equal; grid off; axis([1 sp.Nx 1 sp.Ny -1 1]);
qh = quiver3(X,Y,Z, mx(:,:,1), my(:,:,1), mz(:,:,1)); %view(0,90);
xlabel('x'); ylabel('y'); zlabel('z');
view(35,30);
end
for i = 1:100:sp.Nt % default is 40
set(ih, 'cdata', double(mz(:,:,i)));
set(ith, 'string', ['m_z(n = ', num2str(i), ')']);
if doQuiver
set(qh, 'udata', mx(:,:,i), 'vdata',my(:,:,i), 'wdata',mz(:,:,i));
end
% pause(0.01);
drawnow;
end
fprintf('done\n');