How do I solve an equation that has one vector term with the rest being constant values? If you look at the part after "syms t", I am attempting to solve for "t" but there are 1001 values for m_0 in eqn1 and a 1001 values for every value of b, h(b) and v(b). So, I'm hoping to get a vector T1 containing 1001 values of t for 1001 values of m_0 and the same for T2 for every value of b, h(b) and v(b).
u = 8000; m_e = 1500; g = 32.2;q = 15; t_0 = 0; b = 0:0.1:100;
m_0 = m_e + q.*b;
h_b = ((u.*m_e)./q)*log(m_e./(m_e+q.*b))+u.*b - 0.5.*g.*b.^2;
v_b = u*log(m_0/m_e) - g.*b;
eqn1 = 50000 == u./q.*(m_0-q.*t).*log(m_0-q.*t)+u.*(log(m_0)+1).*t-0.5.*g.*t.^2-((m_0.*u)./q).*log(m_0);
T1 = solve(eqn1, t);
eqn2 = 50000 == h_b+v_b.*(t-b)-0.5.*32.2.*(t-b).^2;
T2 = solve(eqn2, t);
T2_desired = double(T2(2));
T = T2_desired - T1
The output I get is as follows:
Warning: Unable to find explicit solution. For options, see help.
> In solve (line 317)
In ROCKETMAN (line 15)
Index exceeds the number of array elements (0).
Error in sym/subsref (line 900)
R_tilde = builtin('subsref',L_tilde,Idx);