3 views (last 30 days)

Show older comments

I have temp vs time data for 100 points along a circle.

I would like create a small animation of the temp vs time basedon colour of the circle.

(If not a circle I would atleast like to try it along a line. )

Is it possible somehow?

A sample/Example would be like this

This has 6 frames, with the color representing the temperature and frames representing the passage of time.

Here it is made as a contiuous diagram, with smooth gradients. If it is not possible, is it possible as discreet sections of a circle.

Kelly Kearney
on 26 May 2020

It's not clear to me whether you've already created the circle plots in Matlab, or if you just sketched out your desire outcome.

If you haven't plotted them yet, I think using a simple patch is the easiest way to achieve that look. To animate, it depends on whether you just want to animate on screen or export to something like a gif. The example below shows the former.

% Some example data

t = linspace(0,1,100)'; % time coordinate, normalized

data = rand(100,3); % three time steps of random data

% Use patch to plot the circle

th = 2*pi*t;

rmin = 0.8; % inner radius

rmax = 1; % outer radius

xouter = rmax.*cos(th);

xinner = rmin.*cos(th);

youter = rmax.*sin(th);

yinner = rmin.*sin(th);

x = [xouter; xinner(end:-1:1); xouter(1)];

y = [youter; yinner(end:-1:1); youter(1)];

c = [data; data(end:-1:1,:); data(1,:)];

axes

p = patch(x,y,c(:,1));

axis equal;

set(gca, 'visible', 'off');

set(p, 'edgecolor', 'none');

% Loop over to animate

for it = 2:size(data,2)

pause(1);

set(p, 'cdata', c(:,it));

end

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

Start Hunting!