MATLAB: Using numerical values in symbolic expresion

numerical values symbolic expresion

Dear
I am very new using symbolic math
I have a funcion of two variables
syms x y
assume (x 'real')
assume (y 'real')
f=log(x/y);
I would like to plot the funcion usin 2.555 for y
y=2.555;
fplot(f,[1,20])
But the is an error because Matlab sais that f is not a single variable function. Of course I misunderstanding something but I don't know
Thanks in advance,

Best Answer

Even though you assign a new value to y, the function f is still dependent on two symbolic variables. You can use subs to replace y with 2.555:
syms x y
assume (x, 'real')
assume (y, 'real')
f=log(x/y);
fplot(subs(f,y,2.555),[1,20])