How to graph alternative solution of a function
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
HI there, pretty simple question and more of a maths one than a technical MATLAB one.
For each value of Launch Angle there are two solutions for the value of A. I'm plotting one at the moment and want to plot the other. e.g. at launch angle of 10deg, A can equal both 0.21 and 2.2ish
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/285414/image.png)
How do I change my code to plot the other solution?
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 = 1.7; % Y asymptote of curve
XL = 0; % Release point x
X0 = 1.7; % Starting point x
F = @(A,B) [((-Rd + ((2*Rd) /(1 + exp(A*(X0 - B)))))), (((-2*A*Rd*exp(A*(XL-B)))/((exp(A*(XL-B))+1)^2))-tan(qLrad))];
AB0 = [1; 1]*1j;
AB = fsolve(@(b)F(b(1),b(2)), AB0);
A_values(:,qL) = AB(1)*-1;
B_values(:,qL) = AB(2);
end
plot(LaunchAngle, A_values, LaunchAngle, B_values);
xlabel('Launch angle (deg)');
ylabel('Required trajectory function parameters');
title('Required trajectory function parameters for launch point x = 0');
legend('A', 'B');
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!