Solving a set of linear equations interactively

조회 수: 4 (최근 30일)
Chuzymatics Chuzymatics
Chuzymatics Chuzymatics 2014년 12월 13일
편집: per isakson 2014년 12월 13일
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에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by