Movie of multiple cylinders in the same plot.
5 views (last 30 days)
Show older comments
Hey I have the following code to make a movie of multiple frames. The erosion function return radius(a11(1:n+1,frameIndex)) of the pore(cylinder) along the x axis with time. This also represents the pore at the first layer and column. It also returns the concentration of particles driven by the fluid along the x axis given time. I am trying to have a branching structure model. The radius of the pores in the first and second layer would then be a11,a21,a22, respectively. I'm trying to plot 3 cylinders at the same x y z plot with different coordinates depending on the branching index given this function. Any ideas or leads on how to do that?
close all;
clear all;
clc;
[tau,a11,c,it,dx,n,J] = erosion(400,400,40,2,2,0.22,0.09,0.4,1,0.5,1,0)
n=400;
NumberOfPoints = 400;
workspace;
numberOfFrames = 50;
t = linspace(0, 15, J);
hFigure = figure;
allTheFrames = cell(numberOfFrames,1);
vidHeight = 1312;
vidWidth = 2234;
hold on,
allTheFrames(:) = {zeros(vidHeight, vidWidth, 3, 'uint8')};
hold on,
allTheColorMaps = cell(numberOfFrames,1);
allTheColorMaps(:) = {zeros(256, 3)};
myMovie = struct('cdata', allTheFrames, 'colormap', allTheColorMaps);
set(gcf, 'renderer', 'zbuffer');
hold on
ax = gca();
for frameIndex = 1 : numberOfFrames
[x, y, z] = cylinder(a11(1:n+1,frameIndex));
cla reset;
set(gcf, 'Units', 'Normalized', 'Outerposition', [0, 0, 1, 1]);
newmap = jet(190);
ncol = size(newmap,1);
zpos = 1 + floor(2/7 * ncol);
newmap(zpos,:) = [1 1 1];
colormap(newmap);
% C = repmat(c, 1, size(x,1));
h=surf(x,y,z,c);
set(h, 'FaceColor','texturemap','EdgeColor','default','Cdata',c(1:n+1,frameIndex))
hcb=colorbar
colorTitleHandle = get(hcb,'Title');
titleString = 'Concentration of particles';
set(colorTitleHandle ,'String',titleString, 'Fontsize', ax.LabelFontSizeMultiplier*ax.FontSize);
axis('tight')
hold on,
zlim([0, 1]);
xlim([-1, 1]);
ylim([-1, 1]);
set(gca, 'ZDir','reverse') % concentration is BCTOP at x=0 so it has to be at the top.
caption = sprintf('Frame #%d of %d, t = %.1f', frameIndex, numberOfFrames, t(frameIndex));
title(caption, 'FontSize', 15);
drawnow;
thisFrame = getframe(ax);
end
0 Comments
Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!