using numerical values in symbolic expresion

1 view (last 30 days)
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,

Accepted Answer

Tommy
Tommy on 24 Apr 2020
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])

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!