Trying to find a value at a specific point in an array.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chett Manly
el 24 de Oct. de 2021
Comentada: Chett Manly
el 24 de Oct. de 2021
What I am trying to do is find the value of Hmax @ Tmax.
Tmax is a product of Vmax.
clear; close all; clc
G = 9.80665; %gravity
D = 0.1;
v0 = 0; %Start velocity
h0 = 38969; %start height
t0 = 0; %start time
T = 0.01;
A = 0.7; %area pre parachute
m = 118; %mass
%p = 1.2; %rho
C = 1; %drag
%% part a
v(1) = v0;
H(1) = h0;
t(1) = T;
n = 1;
%
% vc = sqrt(2*m*g/(p*C*A))
% tc = vc/g
% hc = vc*tc
while 1
if H(n) < 1043 %break when ground is reached
break
end
Hkm = H(end)/1000;
g = G*6356.766.^2/(6356.766+Hkm).^2;
p = 1.2241*exp(-(Hkm/11.661)-(Hkm/18.192)^2+(Hkm/29.235)^3);
vc = sqrt(2*m*g/(p*C*A));
tc = vc/g;
hc = vc*tc;
if n > 26000 %50 sec parachute Drag increase
A = 50;
C = 3.17;
end
%a(n) = -g - D*v(n)*abs(v(n));
a(n) = -g*(1-v(n)^2/((vc^2)));
%a(n) = g*(vc^2-v(n)^2)/(vc*cosh(t-t0/tc))+v0*sinh(t-t0/tc);
v(n+1) = v(n) + a(n)*T;
%v(n+1) = vc*(v0/vc)+tanh(t-t0/tc)/(1+v0/vc*tanh(t-t0/tc));
H(n+1) = H(n) + v(n)*T;
n = n+1;
t(n) = n/100;
end
ng = n-1;
tg = (n-1)*T;
a(end+1)=0;
vneg = -v;
aneg = -a;
plot(t,H,'r-');
xlabel('T')
ylabel('H')
title('H(t)')
legend('height')
grid on
[Vmax,Tmax] = max(vneg);
% Hmax??? neet to find the value of H @ Tmax
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre FPGA, ASIC, and SoC Development en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!