Store m iterations of a variable in for loop
1 view (last 30 days)
Show older comments
clear all; clc; close all;
%generate random values for VN, VE, VD in vector form
VN_random = randi(100,10,1);%(feet/second)north velocity (column vector of random velocities)
VE_random = randi(100,10,1);%(feet/second)east velocity
VD_random = randi(20,10,1);%(feet/second)down velocity
%generate random velocities for position extrapolation
%initial velocity
m = 10;
for i = 1:m
VN_array(i) = VN_random(i) %array of n random numbers
VE_array(i) = VE_random(i) %array of n random numbers
VD_array(i) = VD_random(i) %array of n random numbers
end
VN_array = VN_array'
VE_array = VE_array'
VD_array = VD_array'
%generate m iterations of LAT_3,LON_3,ALT_3
step = 1
m = 10
for array = i:step:m
%initial velocity
VN = VN_array(i);%(feet/second)north velocity
%VE = 0 ;%(feet/second)east velocity
%VD = 0 ;%(feet/second)down velocity
%call position extrapolation function
%[LAT_3,LON_3,ALT_3] = Position_Extrapolation(t_0,t_final,VN,VE,VD,LAT,LON,ALT)
[LAT_3,LON_3,ALT_3] = Position_Extrapolation(0,100,VN,0,0,pi/4,pi/4,10)
end
Above is an attached piece of code that generates the outputs LAT_3, LON_3 and ALT_3. These outputs (which are part of a function I called in the script (Posittion Extrapolation) are located inside of a for loop, which is designed to run the function through m iterations of the variable VN. The variable VN is an input variable of the function that I am attempting to run through the function m times and store these values as an array. How would I go about running the variable "VN" m times (as created by the random number generator) through the function "Position Extrapolation" and store them in an array?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Conway's Game of Life in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!