Mesgrid of time dependent coordinates

3 次查看(过去 30 天)
I am trying to use a mesgrid operation to define a series of time-depedent grids.Currently, I am using a "for" loop, but I would like to vectorize this operation
For example,
for tt=1:1000
x(tt)=100*cos(tt)
y(tt)=100*sin(tt)
[X, Y] = meshgrid[x(tt)-2:x(tt)+2, y(tt)-2:y(tt)+2]
end

回答(1 个)

Star Strider
Star Strider 2020-10-1
I am not certain what you want to do.
Experiment with this:
tt = linspace(-pi, pi, 50);
x = 100*cos(tt);
y = 100*sin(tt);
[X,Y] = meshgrid(x, y);
.
  2 个评论
Vladimir
Vladimir 2020-10-1
Sorry, my bad for confusion, I should not have picked cos and sin .
In general, I have a time dependent trajectory of (x,y) coordinates that may be more complicated than just sinusoidal motion.
At every time step of this trajectory I want to re-create a meshgrid and re-compute some function F (X,Y)
Star Strider
Star Strider 2020-10-1
I am not certain what you want to do, however that should be relatively straightforward. Choose the functions you want, and calculate them as I did, then calculate with the new mesh (likely in a loop) and store the results.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Execution Speed 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by