sym: how to subs two variables

7 次查看(过去 30 天)
Matze
Matze 2021-12-2
回答: HWIK 2021-12-2
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

回答(1 个)

HWIK
HWIK 2021-12-2
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)

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by