Store m iterations of a variable in for loop
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Conway's Game of Life についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!