How do I make this command to get the result correctly? Please help me to solve this..

1 回表示 (過去 30 日間)
I have two functions. for example,
f(x) = 3x^2-2y+5 (plot for x>1);
g(x) = 4x^3-3x-7;
For f(x), x is variable and y is a arbitrary fixed number. So, by choosing arbitrary 'y', I can have many graphs for f(x) (for instance: if 'y=2' then I can have one graph for f(x), and for 'y= 2.01' I will have other graph and so on). And For g(x), x is a variable. So, I will get only one graph for g(x) for non-negative x.
My goal is to find an unique intersection point 'x_0' between g(x) and f(x) such that,
g(x_0) = c(constant) + minimum(f(x)).
here I can change y arbitrarily in f(x), to get my correct 'x_0'. So, I might need to do iteration here. But I don't know how to write this command. Please help me. Thank you for your time.
N.B.:I posted this question couple of days before and there was some typos, that is why I asking again with corrections.

採用された回答

Dimitris Kalogiros
Dimitris Kalogiros 2018 年 10 月 2 日
編集済み: Dimitris Kalogiros 2018 年 10 月 2 日
If you have license for symbolic math toolbox, try this :
close all
clearvars
syms x y
f(x)=3*x^2-2*y+5
g(x)=4*x^3-3*x-7
figure;
fplot(g(x), [0 3]); hold on;
for yval=-5:1:5
f1(x)=subs(f(x),y,yval);
fplot(f1(x),[0,3]);
end
grid on; zoom on;
Results, should be something like this:
  3 件のコメント
Dimitris Kalogiros
Dimitris Kalogiros 2018 年 10 月 2 日
Try this:
close all
clearvars
syms x y;
f(x)=3*x^2-2*y+5
g(x)=4*x^3-3*x-7
figure;
fplot(g(x), [0 3]); hold on;
for yval=-5:1:5
f1(x)=subs(f(x),y,yval);
fplot(f1(x),[0,3]);
assume(x, 'real')
x_0=vpasolve(g(x)==f1(x), x, [0, inf])
end
grid on; zoom on;
Md Abu Helal
Md Abu Helal 2018 年 10 月 2 日
@ Dimitris,Thank you so much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by