plotting coordinates vs. time and i need my time to run with or without loop function repeatedly.
5 次查看(过去 30 天)
显示 更早的评论
hi,
i need to plot my corrdinates vs time. and my time to run with a loop function repeatedly. is there any other method for me to try without loop or any command options?
0 个评论
回答(2 个)
Shivam
2025-2-20
Hi Shane,
I am assuming that you have an array of coordinates to be plotted again a time vector, but without a loop.
The given workaround works for 100 points generated using sin function:
% Example data
time = 0:0.1:10;
coordinates = sin(time); % Example coordinate data array
% Plotting without a loop
figure;
plot(time, coordinates);
xlabel('Time');
ylabel('Coordinates');
title('Coordinates vs. Time');
0 个评论
Sam Chak
2025-2-20
Hi @shane
Generally, coordinates can be specified in 2D (planar) or 3D (spatial) formats. If you wish to plot the spatial coordinates against the time vector, resulting in a 4D problem, this can be challenging to conceptualize according to conventional practices. However, if your goal is to visualize the spatial trajectory of the particle over a time interval, you may consider using a parametric plot approach.
Here is my visualization of a particle moving along a spiral path as it approaches the event horizon of a black hole. This representation may be incorrect, as the spiral motion may not stick to the exponential decay law.
syms t
xt = exp(-t/10).*sin(5*t);
yt = exp(-t/10).*cos(5*t);
zt = -t;
fplot3(xt, yt, zt, [0 30])
xlabel('X'), ylabel('Y'), zlabel('Z')
title('Particle orbits and spiral inwards as it falls into the black hole')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!