필터 지우기
필터 지우기

How to solve equation

조회 수: 2 (최근 30일)
Lalit Patil
Lalit Patil 2012년 11월 7일
I have
a = [1 2 3 4]; b = [2 3 4 5];
(X*a - 5)^2 + (X*b - 6)^2 + (X - 4)^2 - 16 = 0
How to create this 4 equations and find the value of 'X' for each equation in MATLAB..?

채택된 답변

Walter Roberson
Walter Roberson 2012년 11월 7일
편집: Walter Roberson 2012년 11월 7일
arrayfun( @(A, B) roots([B^2+A^2+1, -12*B-10*A-8, 61], a, b, 'Uniform', 0)
Alternate approach that reaches the answer you want but with a different sequence of steps:
syms A B X
x = solve((X*A - 5)^2 + (X*B - 6)^2 + (X - 4)^2 - 16, X);
subs(x, {A, B}, {a, b})
This finds the generalized solution as a single equation, and then puts the actual values in, which is the reverse of the steps you asked.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by