Filter löschen
Filter löschen

Problem with syms and subs continues to display the subbed expressions as variables.

1 Ansicht (letzte 30 Tage)
Everytime I try to run this is just returns the variable isolation. It's not giving me values. I can't figure out what's going wrong? Help!
D1 = 1;
D2 = 40;
D3 = 10;
D4 = 70;
Weight1 = 100;
Weight2 = 0;
AllVariables = [D1 D2 D3 D4 Weight1 Weight2];
syms Pug1 Pug2
Set1 = sym('(D1 + D3) * Pug1 - D3 * Pug2 = Weight1');
Set2 = sym('-D3 * Pug1 + (D2 + D3 + D4) * Pug2 = Weight2');
[Pug1,Pug2] = solve(Set1,Set2)
P_1 = double(subs(Pug1,[sym('D1'),sym('D2'),sym('D3'),sym('D4')],AllVariables))
P_2 = double(subs(Pug2,[sym('D1'),sym('D2'),sym('D3'),sym('D4')],AllVariables))
  1 Kommentar
Stephen23
Stephen23 am 26 Feb. 2017
@Anas Deiranieh's: this time I formatted your code for you. Next time you can do it yourself by selecting the code text and clicking the {} Code button above the textbox.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 26 Feb. 2017
D1 = 1;
D2 = 40;
D3 = 10;
D4 = 70;
Weight1 = 100;
Weight2 = 0;
syms Pug1 Pug2
Set1 = (D1 + D3) * Pug1 - D3 * Pug2 == Weight1;
Set2 = -D3 * Pug1 + (D2 + D3 + D4) * Pug2 == Weight2;
[Pug1,Pug2] = solve(Set1,Set2)

Weitere Antworten (0)

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by