complex function inverse plot

7 ビュー (過去 30 日間)
fima v
fima v 2020 年 2 月 26 日
回答済み: KSSV 2020 年 2 月 26 日
Hello, i have a plot a function
y=1/(ln(x)-0.1)
how can i plot X as a function of Y ,when y=[5:0.01:6]
Thanks.
  2 件のコメント
Ankit
Ankit 2020 年 2 月 26 日
編集済み: Ankit 2020 年 2 月 26 日
syms x
y=(5:0.01:6);
y=1./(log(x)-0.1);
g = finverse(y);
plot(y,g);
For this you need symbolic tool box, I would like you to read this link: https://de.mathworks.com/matlabcentral/answers/286749-find-inverse-of-a-function
fima v
fima v 2020 年 2 月 26 日
Hello Ankit, When i ran your code it gave m an error on the plot command
"DATA must be numeric,datetime,duration or an array convertible to double"
g,y has dimentions of 1X1
where is the problem?
Thanks.

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

採用された回答

KSSV
KSSV 2020 年 2 月 26 日
On solving it manually....we have:
y = 1/(log(x)-0.1) ;
x = exp(1/y+0.1) ;
To plot:
y=[5:0.01:6] ;
x = exp(1./y+0.1) ;
plot(x,y)

その他の回答 (1 件)

John D'Errico
John D'Errico 2020 年 2 月 26 日
Note that the natural log function is NOT written as ln in MATLAB, but just as log.
Next, in general, it may be impossible to plot your relationship, because there may be infinitely many disjoint regions over which your plot would need to be generated. For example, suppose you wanted to plot the regions where something as simple as sin(1./x) is between .5 and 1?
If a solution exists, where the function has a simple inverse, and if you have the symbolic toolbox, then finverse can help you.
syms X
Y = 1/(log(X) - 0.1)
fplot(finverse(Y),[5,6]);
xlabel 'Y'
ylabel 'X'
grid on
Or, if you want to use plot, you could do it like this:
syms X
Y = 1/(log(X) - 0.1);
y = 5:.01:6;
xfun = matlabFunction(finverse(Y));
plot(y,xfun(y),'-');
xlabel 'Y'
ylabel 'X'
grid on
If you don't have the symbolic toolbox, then you would need to use a loop, and then use fzero to compute the inverse.

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by