Solving algebraic equations without using symbolic variables
조회 수: 12 (최근 30일)
이전 댓글 표시
How do you solve an algebraic equation like x+y=2 for x without using symbolic variables - for example by defining a function handle y = 1; f = @(x) x+y and setting it equal to 2? Y's value is known so only x needs to be found.
댓글 수: 2
David Hill
2022년 2월 11일
Your question is trival. I have a hard time understanding your question.
y=1;
x=2-y;%x==1
채택된 답변
Steven Lord
2022년 2월 11일
For one equation in one unknown, use fzero.
y = 1;
f = @(x) x + y;
initialGuess = 42;
% Find a zero of f(x) - 2 = 0 which is equivalent to f(x) = 2
x = fzero(@(x) f(x) - 2, initialGuess)
check = f(x) % Should be close to 2
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Algebra에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!