필터 지우기
필터 지우기

empty sym: 0-by-1.

조회 수: 82 (최근 30일)
omid ghorbani
omid ghorbani 2019년 6월 9일
댓글: Sonja Glas 2019년 10월 16일
i want to solve a equation in a algorithm. this equation is ('x-sin(x)=b') .in this equation 'b' calculated of previous step. for example b=0.45.
when i run this, the answer is empty sym: 0-by-1.
but when I run (x-sin(x)=0.45) the answer is correct, means that this equation has numeric answer.
please help me to run this algorithm.
b=0.45
solve('x-sin(x)=b')
ans=
empty sym: 0-by-1
solve('x-sin(x)=0.45')
ans=1.4416

채택된 답변

Steven Lord
Steven Lord 2019년 6월 9일
Don't pass a char vector into solve. Build a symbolic equation and pass that into solve.
syms x
b = 0.45;
eq = x-sin(x) == b
sol = solve(eq)
  댓글 수: 3
omid ghorbani
omid ghorbani 2019년 6월 10일
thank you so much.
this answer is a 1*1 symbol. how can i chang this answer to double type.
Sonja Glas
Sonja Glas 2019년 10월 16일
It should work with vpasolve instead of solve

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by