sym: how to subs two variables

8 views (last 30 days)
Matze
Matze on 2 Dec 2021
Answered: HWIK on 2 Dec 2021
Hello there community-brains,
I try to subs both variables in my 1x1 symbolic function Risym:
- (4755019704836209*x^2*y)/590295810358705651712 + (3714859144393905*x^2)/4611686018427387904 - (8424613852775261*x*y^2)/22835963083295358096932575511191922182123945984 + (3362555543902899*x*y)/576460752303423488 - (1313498259334437*x)/2251799813685248 + (7137508986929047*y^3)/316912650057057350374175801344 - (8632096289783183*y^2)/158456325028528675187087900672 - (1563516049270069*y)/1125899906842624 + 4885987653963271/35184372088832
So there is either x and y. I want to insert my parameters for both of them
  • When i try to substitute them via
subs(Risym,{x,y},{par1,par2})
i get the Error 'Undefined function or variable 'x'.'
  • When i try to substitute one after the other via
Ri_0_T = subs(Risym,par1);
Ri_0_SOC = subs(Ri_0_T,par2);
i get an empy 0x1 sym as a return...
Do you know any other tricks to subs this sym?
Greetings
Newby

Answers (1)

HWIK
HWIK on 2 Dec 2021
From what you pasted I think you have a symbolic expression not function.
I'm guessing you have some values of par1 and par2 and you want to solve for those by substituting for x and y respectively?
Does this give you what you want?
x = par1;
y = par2;
subs(Risym)

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!