Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
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 comentario
Stephen23
Stephen23 el 26 de Feb. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Feb. de 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)

Más respuestas (0)

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by