Effacer les filtres
Effacer les filtres

How to graph alternative solution of a function

1 vue (au cours des 30 derniers jours)
Adam Thompson
Adam Thompson le 17 Avr 2020
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');

Réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by