- do you mean that you have u(i-1) corresponding to x(i) and you want to have u(i) corresponding to x(i)?
- do you mean you want the value u(i) in variable u?
- do you want to access time for that purpose?
Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Identifying a variable in a for loop
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I'm trying to model the two dimensional motion of particles and I have the velocity data of the particles in the x- and y-directions. However, I am trying to use a for loop to move the particles through the geographic space, based on their velocities. The challenge I've run into is that in my for loop I am trying to use the equation x(i) = u(i-1)*dt, where x(i) is the current x-position and u is the x-velocity, and u is known at each x- and y-location. I want to be able to code that u(i) = u at x(i), referring to the data that i inported into matlab, but I'm unfamiliar with how to write that code.
I've attached the excel file here for reference. The x-position is long_E in the file, and the x-velocities are ve. The time series information is also included in the excel file.
Thanks for any suggestions you can offer. I'm still really new to using matlab and to coding in general.
3 commentaires
Mehmed Saad
le 18 Avr 2020
and you have to calculate dt from t ? taking difference between current and previous time
if yes, then take this for example
see the 2nd row of your data
x = -80.3780
u = -0.1801
t = datetime('01-Jan-2015 06:00:00')
dt = 21600; %seconds as 01-Jan-2015 00:00:00 - 01-Jan-2015 06:00:00 = 6Hrs
u_into_dt = u*dt
u_into_dt =
-3.8902e+03
I dont think this is right
can you give an example like that so that i can understand what you are trying to do
Réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!