plotting a symbolic function

조회 수: 10 (최근 30일)
mogin jerry
mogin jerry 2020년 10월 20일
편집: Rena Berman 2021년 5월 7일
i need to create symbolic function f(x) equalling ((3*x-5)/(x-3))
then make symbolic equation, invEqn, by setting x equal to f(y).
solve function to solve invEqn for y and use expression to define the symbolic function finv(x)
Plot f and f^-1 on the same axes.using fplot.
can someone write me a code not sure where to start
  댓글 수: 1
Rik
Rik 2020년 10월 21일
편집: Rena Berman 2021년 5월 7일
Question posted by mogin jerry restored from Google cache.

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2020년 10월 20일
편집: Cris LaPierre 2020년 10월 20일
Sounds like a homework assignment, so I won't provide an answer, but take a look at the fplot function documentation page. One of the examples on that page can be used to get your started on your assignment.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 10월 20일
The first parameter to fplot() must be a symbolic expression or symbolic function or function handle.
The second parameter to fplot() must be the range to plot over.
invEqn = x == f(x);
No,
invEqn = y == f(x);
which you need to solve for x, and the result needs to be a function of y, not a function of x (watch out for what you assign the output to!)
Note: it happens that for functions of the form (A*X-B)/(x-A) that the solution is x = (A*Y-B)/(Y-A) -- just replacing the X with Y. If you plot over the same range, you are not going to be able to tell the functions apart.
This is not something that happens in general, only for that special form. If it were (A*X-B)/(x-C) then the solution would be (C*Y-B)/(Y-A) with the constant having moved from the denominator to the numerator... but your constants are the same between numerator and denominator.
Rik
Rik 2020년 10월 21일
Deleted comment:
done this so far:
syms y x f(x) finv(x)
f(x) = ((3*x-5)/(x-3)) ;
Eqn = f(x)==((3*x-5)/(x-3));
invEqn = x == f(x);
finv(x)=invEqn;
fplot(x,f(x))
fplot(x,finv(x))
but its not plotting the graphs opens a blank graph and keeps giving me errors

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by