How to animate the change of values on different points across a cylinder object?

조회 수: 5 (최근 30일)
To begin with, I want to point out that I am new to Matlab.
I have temperature values (function of time) for points across a cylinder. I would like to make an animation out of the change of the temperature values across the cylinder with time. So what I expect as output is a cylinder object (3D), which has different colors on different areas according to the temperature value at that area for that time point. The animation will show how these temperature values change with time. For example red will point out to high temperatures and when an area gets 'blue' it will mean that the temperature value decreases. In the attached image, I tried to show you what I want to animate.
How can I realise it using MATLAB (with any other add-ons)? Which add-ons should I use? Simulink 3D Animation?
I tried to make use of this Heat Transfer Visualization example, which is seemingly relevant to my use case, but could not change it for my needs.
Any help or leed would help me.
Thank you in advance.
P.S: I am working with MATLAB R2022b running on Ubuntu 20.04

답변 (1개)

Sathvik
Sathvik 2023년 5월 3일
Hi Emirali Caferzade
You can go about creating the animation by following the below steps.
1. First, create the cylinder using the ‘cylinder’ plot.
[X,Y,Z] = cylinder(r)
2. You can then create the cylinder surface using the 'surf' function
surf(X, Y, Z, 'FaceColor', 'interp' , 'EdgeColor', 'none'); % to color the Cylinder based on temperature values
3. Finally, you can loop over the time steps with a brief pause to create the animation effect
for t=1:time_steps
set('CData', 'T', 'FaceColor','interp'); %where T is the Temperature Array
pause(0.1);
end
This is just a sample code. Do explore the functions to see what works best for you. You can refer the below mentioned documentations for more help.
Cylinder Plot
Surface Plot
Set properties

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by