필터 지우기
필터 지우기

The MATLAB function to solve implicit equation

조회 수: 215 (최근 30일)
Teja Reddy
Teja Reddy 2023년 3월 1일
답변: Steven Lord 2023년 3월 1일
Hi all,
Thanks once again to answer my questions every time.
I would like to request you tell me the best way to solve an Implicit equation in MATLAB.
Thank you very much
  댓글 수: 6
Torsten
Torsten 2023년 3월 1일
이동: John D'Errico 2023년 3월 1일
You open one time [ and close two times ] ] . Still unbalanced parenthesis.
Teja Reddy
Teja Reddy 2023년 3월 1일
I am extremely sorry for the confusion created
[m^2 /( 3(a+a0)^2)] * (2 * k1 + 3 * k2) = a0 * (2/v1 + 5/v2)
this is the correct one.
Thank you

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

채택된 답변

Steven Lord
Steven Lord 2023년 3월 1일
@John D'Errico posted how to solve this equation symbolically, if you don't have values for the various symbols used in the code. If you do have values for the symbols (except for a0, the symbol for which you're trying to solve) write a function to evaluate f(a0) and use fzero.
m = 1;
a = 2;
k1 = 3;
k2 = 4;
v1 = 5;
v2 = 6;
EQ = @(a0) [m^2 /( 3*(a+a0)^2)] * (2 * k1 + 3 * k2) - (a0 * (2/v1 + 5/v2));
y = fzero(EQ, 7)
y = 0.6782
check = EQ(y) % should be small
check = -1.1102e-16
I changed your EQ slightly. Instead of being [one expression] == [a second expression] I made it f(a0) = [one expression] - [a second expression]. fzero solves for where that f(a0) is equal to 0 which is equivalent to your formulation.

추가 답변 (1개)

John D'Errico
John D'Errico 2023년 3월 1일
편집: John D'Errico 2023년 3월 1일
Assuming your question is how to solve the equation
[m^2 /( 3(a+a0)^2)] * (2 * k1 + 3 * k2) = a0 * (2/v1 + 5/v2)
I removed the second closing ], since it seems to have been the spurious one. Even if not, the solution is still little different. Just use solve. This is just a simple polynomial equation at heart. And, you NEED to use * to multiply. MATLAB does not allow implicit multiplication. That is, 3(a+a0) is NOT seen as 3*(a + a0) in MATLAB. It is just a syntax error.
syms m a a0 k1 k2 v1 v2
EQ = [m^2 /( 3*(a+a0)^2)] * (2 * k1 + 3 * k2) == a0 * (2/v1 + 5/v2)
EQ = 
a0sol = solve(EQ,a0,'maxdegree',3)
a0sol = 
Yes, the rsult is messy. But what do you expect from what is effectively a cubic polynomial? Not all problems have a nice simple solution. In fact, most implicit equations are written in that form because they do not have a simple solution, and worse yet, most implicit equations will have no algebraic solution at all.
  댓글 수: 1
Teja Reddy
Teja Reddy 2023년 3월 1일
I understood your explanation in a very good manner. Yes, I am expecting the value of "a0".
Thank you

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by