% Y asymptote of curve
Rd = 2;% Release point x
XL = -1;% Starting point x
X0 = 2.5;% Find A for launch angles 0-45deg
A_values = ones(1,45);B_values = ones(1,45);LaunchAngle = ones(1, 45);for qL = 1:45 LaunchAngle(1,qL) = qL; qLrad = deg2rad(qL); Rd = 2; % Y asymptote of curve XL = -1; % Release point x X0 = 2.5; % Starting point x syms A syms B F = [(((-2*A*Rd*exp(A*(XL-B)))/((exp(A*(XL-B))+1)^2))-tan(qLrad)== 0), ((-Rd + ((2*Rd) /(1 + exp(A*(X0 - B))))) == 0)]; AB = vpasolve(F, [A, B]) A_values(1,qL) = AB.A; B_values(1,qL) = AB.B;end
I understand i'm currently trying to store the incorrect number of elements but I'm new to MATLAB and don't see how I'm doing this.
Offending line is:
A_values(1,qL) = AB.A;
Best Answer