using numerical values in symbolic expresion

1 次查看(过去 30 天)
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,

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by