我想解方程组代码如下:c=300;
r1=20;
syms r2 R1 R2 l
eq1='R1-4*r1=0';
eq2='R2-2*r2=0';
eq3='2*300+1.57*(r1+R1)+(r1-R1)^2/(4*300)=2*300+1.57*(r2+R2)+(r2-R2)^2/(4*300)';
[r2,R1,R2]=solve(eq1,eq2,eq3,'r2,R1,R2')
问题是我知道c和r1,为什么结果还包含c和r1,应当怎么处理

 Accepted Answer

citivo
citivo on 24 Nov 2022

0 votes

写成 sol 是告诉你内定返回值顺序是 R1,R2,r2,这是一个结构体,要得到 R1,R2,r2可以用:
sol.R1
sol.R2
sol.r2
用sol做返回值的好处是不用关心返回值顺序。
由于现在已经知道正确的顺序是 R1,R2,r2,也可以写成正确的返回顺序:
[R1,R2,r2] = solve(eq1,eq2,eq3,r2,R1,R2)

More Answers (0)

Categories

Find more on 数学 in Help Center and File Exchange

Tags

Asked:

on 24 Nov 2022

Answered:

on 24 Nov 2022

Community Treasure Hunt

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

Start Hunting!