Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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 commentaire
Stephen23
Stephen23 le 26 Fév 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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 26 Fév 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)

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by