フィルターのクリア

Plot two equations and find the intersect

2 ビュー (過去 30 日間)
Brian Robinson
Brian Robinson 2020 年 4 月 4 日
コメント済み: John D'Errico 2020 年 4 月 4 日
I want to solve numerically for the intersects, plot the curve and line and show the intersects on the plot . E is the x axis and y is the y axis. We have;
g=9.81;v=1;y1=2;q=v*y1;z=0.9;
Syms E y2
eqn1 = E==2*g*y2^3+y2^2(2*g*z-2*g*y-q^2/y1^2)+q^2 = 0;
eqn2 = E==3;
That is as far as I got.
Thanks in advance.
  2 件のコメント
KSSV
KSSV 2020 年 4 月 4 日
What is y?
Brian Robinson
Brian Robinson 2020 年 4 月 4 日
Sorry that y should read y1.

サインインしてコメントする。

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 4 日
Try this
g=9.81;v=1;y1=2;q=v*y1;z=0.9;
syms E y2
E1 = 2*g*y2^3+y2^2*(2*g*z-2*g*y1-q^2/y1^2)+q^2;
E2 = 3;
sol = double(solve(E1==E2));
fplot(E1, [-0.5 1.5]) % plot from -5 to 5 on x-axis
hold on;
fplot(E2, [-0.5 1.5])
plot(sol, E2*ones(size(sol)), 'ro');
  8 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 4 月 4 日
Brian, the function handle E1, has two inputs. fimplicit plot 1st on x and 2nd on y-axis.
John D'Errico
John D'Errico 2020 年 4 月 4 日
Exactly. Had I created the function handle as:
E1 = @(y2,E) 2*g*y2.^3+y2.^2.*(2*g*z-2*g*y1-q^2/y1.^2)+q^2 - E;
then E would be on the y axis.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by