Filter löschen
Filter löschen

using numerical values in symbolic expresion

1 Ansicht (letzte 30 Tage)
Luis Isaac
Luis Isaac am 24 Apr. 2020
Beantwortet: Tommy am 24 Apr. 2020
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,

Akzeptierte Antwort

Tommy
Tommy am 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])

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by