필터 지우기
필터 지우기

"simplify" doesn't work properly

조회 수: 29 (최근 30일)
ercan duzgun
ercan duzgun 2018년 8월 15일
댓글: Christopher Creutzig 2018년 12월 3일
Dear Matlab users;
I have a problem when I use symbolic toolbox. When it gives the result in symbolic, even though I use simplify comment, it doesn't work properly as I want it to be.
I will give a similar example here, since the actual one is a bit long:
2*(sin(x)*1/2+cos(x)*1/2)
When I calculate the result myself by hand, I get;
sin(x)+cos(x) .
But MATLAB gives the result as I written above.
How can I fix this?
Thanks in advance.
  댓글 수: 1
Christopher Creutzig
Christopher Creutzig 2018년 12월 3일
It would probably help to give an actual working example of your problem.

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

채택된 답변

Star Strider
Star Strider 2018년 8월 15일
편집: Star Strider 2018년 8월 15일
Choosing the correct function is important. Without knowing your actual expression (so I do not know if this is appropriate for it), expand or isolate rather than simplify may be most appropriate:
syms x
Eq = 2*(sin(x)*1/2+cos(x)*1/2);
R = expand(Eq)
R =
cos(x) + sin(x)
  댓글 수: 1
Christopher Creutzig
Christopher Creutzig 2018년 12월 3일
For this input, Eq is already in the expected form.

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

추가 답변 (1개)

ercan duzgun
ercan duzgun 2018년 8월 15일
Well, as I find out: the vpa comment fix this problem better.
  댓글 수: 1
Star Strider
Star Strider 2018년 8월 15일
The vpa function is certainly another option.

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by