Generally, you must have in mind that : 
Taking that under consideration you can use the following piece of code
clear; clc;
syms x
f(x)=(x^2) / (1+sqrt(x))
fplot(f(x), [0, 3]);
grid on; xlabel('x'); ylabel('f(x)')
x0=vpasolve(f(x)==2)
finv(x) = finverse(f);
x0_verification=vpa(finv(2))
If you don't aim to use symbolic toolbox, you can use simple matlab instructions in order to calculate value x0:
clear; clc;
f=@(x) (x^2)/(1+sqrt(x));
y0=2;
x0=0;
yerror=f(x0)-y0;
yerror_previous=yerror;
dx=0.1;
while abs(yerror)>1E-5
if yerror*yerror_previous<0
dx=0.1*dx;
end
yerror_previous=yerror;
x0=x0-sign(yerror)*dx;
yerror=f(x0)-y0;
end
fprintf(' finverse(2)= x0 = %f \n', x0);
2 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/485641-how-to-find-inverse#comment_756839
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/485641-how-to-find-inverse#comment_756839
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/485641-how-to-find-inverse#comment_756872
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/485641-how-to-find-inverse#comment_756872
Sign in to comment.