How plot charts/sim animation like battery simulation chart function of simscape battery?

조회 수: 2 (최근 30일)
Hi,
I have the time vs temperature data in 3D and I want ti visualize it same as the battery simulation chart functionality (https://www.mathworks.com/help/simscape-battery/ref/simscape.battery.builder.batterysimulationchart.html)
How do I create such charts/animation?
  댓글 수: 2
Malay Agarwal
Malay Agarwal 2024년 9월 24일
Do you want to replicate the plot generated by batteryChartSimulation or want to create an animated plot in general?

댓글을 달려면 로그인하십시오.

답변 (1개)

Epsilon
Epsilon 2024년 9월 25일
Hi Soham,
Animating a plot generally involves updating the plot inside a loop by updating the values or properties.
Example code for an animated 3Dplot where the ‘ZData’ is being updated:
% Example data
time = linspace(0, 10, 100);
position = linspace(0, 5, 50);
[Time, Position] = meshgrid(time, position);
temperature = sin(Time) .* cos(Position);
% Create a 3D surface plot
figure;
h = surf(Time, Position, temperature, 'EdgeColor', 'none');
ylabel('Position');
zlabel('Temperature');
colormap('hot');
colorbar;
% Animate the plot over time
for k = 1:length(time)
% update ZData for each frame to simulate animation
set(h, 'ZData', sin(Time - time(k)) .* cos(Position));
pause(0.1);
end
Also refer to the documentation on animation for further clarification:https://www.mathworks.com/help/matlab/animation-1.html
Hope it helps you get started!

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by