I simply do not understand how there is an error here,
>> f = symsum((1/(2*n-1))*sin((2*n-1)2*x), n, 1, 5)
Error: Unexpected MATLAB expression.
To clarify the arrow is pointing at the "2" next to "x".
Edit: I have defined x and n as symbolic, but the error still occurs.

 채택된 답변

Birdman
Birdman 2017년 10월 26일
편집: Birdman 2017년 10월 26일

1 개 추천

You have not defined n and x as symbolic.
syms n x
f = symsum((1/(2*n-1))*sin((2*n-1)*2*x), n, 1, 5)

댓글 수: 3

Ian Bathgate
Ian Bathgate 2017년 10월 26일
The error still occurs
Birdman
Birdman 2017년 10월 26일
I edited the equation. There was a operator missing. Now check the answer.
Ian Bathgate
Ian Bathgate 2017년 10월 26일
Thank you so much, I sat there looking at it for nearly 20 minutes. thanks.

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

추가 답변 (1개)

Jan
Jan 2017년 10월 26일
편집: Jan 2017년 10월 26일

3 개 추천

"(2*n-1)2*x" is no valid Matlab expression, because the operator after ")" is missing. I guess:
f = symsum((1/(2*n-1))*sin((2*n-1) * 2*x), n, 1, 5)
% ^ inserted

댓글 수: 2

Birdman
Birdman 2017년 10월 26일
Exactly
Jan
Jan 2017년 10월 27일
:-) This was a duplicate answer given in the same minute.

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

카테고리

도움말 센터File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

태그

질문:

2017년 10월 26일

댓글:

Jan
2017년 10월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by