Hi,
I keep getting error messages about line 32 (Vy (i) = line). I double checked the brackets and they seem to match up. Below is the error message I am recieving.
Index exceeds the number of array elements (1).
Error in CC551_A5_P3 (line 32)
Vy(i) = Vx(i)*(tand(phi_o(i))-(g*t(i)/Vx_o)*(1+(0.5*Vx_o*k1*t(i)))); % y direction velocity
Thank you!
% Given Information In Problem
Vx_o = 2060; % muzzle velocity (ft/s)
k1 = 0.00082; % (1/ft) note: converted from 0.00025 (1/m)
p = 0.0751; % (lbm/ft^3) row - standard sea level met data
a = 1120; % (ft/s) standard sea level met data
% initial conditions
t = 0; % (s)
g = 32.174; %gravitational constant (ft/sec^2) [at sea level]
%setting up inital conditions at i = 1
t(1) = 0; Vx(1) = 2060; x(1) = 0; phi_o(1) = 0; phi(1) = 0;for i = 1:6 x(i)= (i-1)*200*3; % x3 = converting range from yards to feet
Vx(i) = Vx_o*exp(-k1*x(i)); % striking velocity
t(i) = ((x(i)/Vx_o)*((Vx_o/Vx(i))-1))/log(Vx_o/Vx(i)); % time of flight
Vy(i) = Vx(i)*(tand(phi_o(i))-(g*t(i)/Vx_o)*(1+(0.5*Vx_o*k1*t(i)))); % y direction velocity
phi(i) = (atand(Vy(i)/Vx(i))); % impact angle
phi_o(i) = atand(tand(phi(i))+((g*t(i)/Vx_o)*(0.5*(1+(Vx_o/Vx(i))))));endRange_Table = table(x(:)/3, Vx(:), t(:), phi_o(:), phi(:),... 'VariableNames',{'yards', 'impact velocity (ft/s)', 'time of flight (s)', 'inital QE angle (degrees)', 'impact angle (degrees)'})
Best Answer