Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

Subs in Matlab symbolic toolbox does not evaluate values

I try to substitute long expressions with short variables. Here I want to replace 3*b^2with d. After that, I want to evaluate the expression a with numeric values. But somehow Matlab does not recognize if I assign a value to b and instead refers to the UNKNOWN variable d. How do I subsitute with d and also tell Matlab to compute d as a function of b?

syms a b c d
a = 3*b^2 + c;
a = subs(a, 3*b^2, d)     % substitute long term
subs(a,{b,c},{2,3})       % Returns ans = d + 3, But I want it to return ans = 15
question from:https://stackoverflow.com/questions/65864027/subs-in-matlab-symbolic-toolbox-does-not-evaluate-values

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...