Azzera filtri
Azzera filtri

How to graph alternative solution of a function

1 visualizzazione (ultimi 30 giorni)
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
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');

Risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange

Prodotti


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by