Solving set of 2 equations doesn't give a numerical solution

조회 수: 1 (최근 30일)
Alexander
Alexander 2014년 11월 21일
댓글: MA 2014년 11월 21일
Hi there,
I'm solving a quite simple equation on my computer with the following code:
clc
clear all
close all
syms x y
eq1 = 2*x+3 == 7*y;
eq2 = 2*y*7 == 123 + 2*x;
[x,y] = solve(eq1,eq2,x,y)
Doing this on my laptop (matlab 2014) the solution gives: x = [x] and y = [y]
Running this code on the laptop of my colleague (matlab 2012) gives a solution: x = [117/2] and y = [120/7]
Is there a toolbox that needs to be installed for solving sets of equations or a preference that needs to be checked? I've been able to calculate them in the past but since a week I'm unable of solving them.
Thanks for your help, Alexander

채택된 답변

MA
MA 2014년 11월 21일
clc
clear all
close all
syms x y
eq1 = 2*x+3-7*y;
eq2 = 2*y*7-123-2*x;
S= solve(eq1,eq2,x,y);
S=[S.x S.y]
  댓글 수: 3
Alexander
Alexander 2014년 11월 21일
Thanks for your quick answer. It was very helpful!
MA
MA 2014년 11월 21일
you're Welcome

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by