필터 지우기
필터 지우기

solve() "Unable to find explicit solution"

조회 수: 14 (최근 30일)
Andrew
Andrew 2023년 10월 13일
댓글: Andrew 2023년 10월 13일
Using solve for an equation is not working and I'm not sure why. This has an explicit solution but it doesn't work. What am I missing?
syms g m L s Y(s)
solve(- m*(s - s^2*Y(s) + 1)*L^2 + g*m*Y(s)*L == 0,Y(s))
Warning: Unable to find explicit solution. For options, see help.
ans = struct with fields:
m: [0×1 sym] s: [0×1 sym]

채택된 답변

Dyuman Joshi
Dyuman Joshi 2023년 10월 13일
solve() expects the 2nd input to be an array of symbolic variable(s), where as you have defined Y as a symbolic function.
If you want to get the output as a function of "s", define it accordingly -
syms g m L s Z
Y(s) = solve(- m*(s - s^2*Z + 1)*L^2 + g*m*Z*L == 0,Z)
  댓글 수: 1
Andrew
Andrew 2023년 10월 13일
Thanks! This was the problem.

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

추가 답변 (2개)

Sam Chak
Sam Chak 2023년 10월 13일
If this is related to deriving the transfer function using Laplace transform, then I prefer using the isolate() function.
syms g m L s Y(s)
Eqn = - m*(s - s^2*Y(s) + 1)*L^2 + g*m*Y(s)*L == 0;
Eqn = isolate(Eqn, Y(s))
Eqn = 
  댓글 수: 1
Andrew
Andrew 2023년 10월 13일
Yeah it is related to the transfer function. This is very useful thanks for your help.

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


Walter Roberson
Walter Roberson 2023년 10월 13일
(I am absolutely positive I had already answered this, but there is no trace of that...)
solve() cannot solve for functions. You will need to substitute a symbolic variable for the function. For example,
syms g m L s Y(s) Ys
eqn = - m*(s - s^2*Y(s) + 1)*L^2 + g*m*Y(s)*L == 0;
solve( subs(eqn, Y(s), Ys), Ys)
ans = 
  댓글 수: 1
Andrew
Andrew 2023년 10월 13일
Thanks! This was the problem.

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

카테고리

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

태그

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by