Solving a set of linear equations interactively

1 次查看(过去 30 天)
Dear All!
I intend to solve a set of linear equations using coefficients obtained from run time. Matlab displays:
solution =
x: [1x1 sym]
y: [1x1 sym]
symbolic expressions I cannot convert to readable numbers even with double() function. Pls help
% Code solves a general linear sim equation in two variables
% Accept coefficient of x in line one
a11 = input('Enter coefficient of x eqn one:')
a12 = input('Enter coefficient of y in eqn one: ')
c1 = input('Enter the constant term in eqn one:')
eqn_one = sym( 'a11*x + a12*y + c1');
a21 = input('Enter coefficient of x in eqn two:')
a22 = input('Enter coefficient of y in eqn two:')
c2 = input('Enter the constant term in eqn two:')
eqn_two = sym( 'a21*x + a22*y + c2');
solution = solve(eqn_one, eqn_two)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by