How do you substitute multiple variable in to an equation??

4 views (last 30 days)
I have a simple case where
syms x y;
f= x+y;
how shoud I substitute x and y seperately??
just like subs function: subs(f, 1) which only substitutes y in this case

Answers (2)

Walter Roberson
Walter Roberson on 10 Mar 2020
Edited: Walter Roberson on 10 Mar 2020
subs(f, variable_name, new_value)

Star Strider
Star Strider on 10 Mar 2020
Symbolic functions are possible beginning with R2012a (if I remember correctly).
This should do what you want:
syms x y
f(x,y) = x+y;
A numeric equivalent would be:
f = @(x,y) x + y;

Community Treasure Hunt

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

Start Hunting!