Solving a set of linear equations interactively
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Numbers and Precision in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!