Tensor matrix of speed

2 views (last 30 days)
JORGE ORDOÑEZ CARRASCO
JORGE ORDOÑEZ CARRASCO on 15 Feb 2022
Hi everyone i got confused in tensor matrix of matlab, i have a code which calculates position and speed of 1000 particle update the position and speed, so i have a double for running one for the particles and the other for the next step, particle position and speed is updated and i need to save some positions and speed to see the this evolution. But im confuse i have this code:
As you can see bellow the matrix obtained (A(n_particle x 3 x n_steps)) the front of the cube, as i get it is read A(:,:,1) , but i need to obtain the top of this cube in the logic of matlab i know is A(1,:,:) but it only returns the first row data. I expect a tensor dimensions n_particle x 3 x n_steps for particle 1 i expect to see the evolution, what im doing wrong?
Thank you
for i=1:n_particles
for j=1:n_steps
Here i do my calculations
x_position=newposition
u_speed=newespeed
A(i,:,j)=newposition %supposely a particle i has j steps
B(i,:,j)=newspeed
end
end

Answers (0)

Categories

Find more on Discrete Math in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!