Linear equations with three unknowns

New to matlab, trying to solve something like this (this is just an exampe)
120x - 55y - 75z = 0
111x - 67y - 21z = 0
34x - 92y - 11z = 0
but it is known that x^2 + y^2 + z^2 = 1
im trying to end up with x and z so i can use this ^ to find y
Thank you

답변 (1개)

Paul
Paul 2022년 10월 5일

0 개 추천

Hi Ahmed,
The problem in the Question is ill-defined becasue there are no values of (x,y,z) that satisfy all four equations.
If you have a set of equations that does have a solution, fsolve might be useful for example
A = [120 -55 -75;111 -67 -21]; % first two equations from the Question
p = fsolve(@(p) [A*p(:);sum(p.^2)-1],[1 0 0]) % p = [x y z]
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
p = 1×3
0.5345 0.8018 0.2673
For this problem, p is simply the unit-norm basis vector for the null space of A, as it should be
null(A)
ans = 3×1
0.5345 0.8018 0.2673

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 10월 5일

답변:

2022년 10월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by