Error using sin in my code
조회 수: 4 (최근 30일)
Dyuman Joshi 2023년 9월 19일
sin is not a variable that you are multiplying with s*r0*t, it is a function which needs input arguements to provide an output.
So, remove the element-wise multiplication sign in between sin and the parenthesis, and it should work (Assuming variables have compatible sizes for the operations performed)
x = z + (1/s).*sin(s*r0*t);
추가 답변 (1개)
Walter Roberson 2023년 9월 19일
The .* operator is element-by-element multiplication. Your code is asking to evaluate the token sin and multiply the result by (s*r0*t) . But sin as a token is a request to evaluate the sin function with no parameters, which is a problem because sin() needs to be passed one parameter.
If you want to take the sine of something, you need sin(EXPRESSION) such as sin(s*r0*t)