MATLAB Answers

complex function inverse plot

조회 수: 7(최근 30일)
fima v
fima v 26 Feb 2020
답변: KSSV 26 Feb 2020
Hello, i have a plot a function
how can i plot X as a function of Y ,when y=[5:0.01:6]

  댓글 수: 2

Ankit 26 Feb 2020
syms x
g = finverse(y);
For this you need symbolic tool box, I would like you to read this link:
fima v
fima v 26 Feb 2020
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?

로그인 to comment.

채택된 답변

KSSV 26 Feb 2020
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) ;

  댓글 수: 0

로그인 to comment.

추가 답변(1개)

John D'Errico
John D'Errico 26 Feb 2020
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)
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));
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.

  댓글 수: 0

로그인 to comment.

이 질문에 답변하려면 로그인을(를) 수행하십시오.


Translated by