フィルターのクリア

How to graph alternative solution of a function

1 回表示 (過去 30 日間)
Adam Thompson
Adam Thompson 2020 年 4 月 17 日
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');

回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by