Help debugging a symbolic expression error

조회 수: 10 (최근 30일)
Cameron
Cameron 2016년 10월 19일
답변: Star Strider 2016년 10월 19일
I'm trying to create a symbolic expression but don't fully understand the error I get. Code and error below.
syms l t b
f(l,t,b)=l((t/b)-(sin((2*pi*t)/b)/(2*pi)));
And the error:
Error using sym/subsindex (line 737)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic
variables and the body of the function is a SYM expression. When indexing, the input must be numeric, logical,
or ':'.
Error in sym/subsref (line 776)
R_tilde = builtin('subsref',L_tilde,Idx);
I've tried making smaller expressions with syms variables and constants to eliminate the possibility that constants can't be used.

채택된 답변

Star Strider
Star Strider 2016년 10월 19일
You’re missing a multiplication operator. MATLAB does not recognise implicit multiplication.
syms l t b
f(l,t,b) = l*((t/b)-(sin((2*pi*t)/b)/(2*pi)));
↑ ← INSERT ‘*’ HERE
That runs without error.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by