How to type sin function with square
조회 수: 124 (최근 30일)
이전 댓글 표시
I'm working with O.D.E in matlan and I found that I cannot type sin square x. Is there any particular syntax for that or is there any other way?
댓글 수: 0
채택된 답변
Sam Chak
2023년 11월 20일
@John Sanjai J, are you expecting this?
syms x
expr = sin(x)^2
댓글 수: 5
Sam Chak
2023년 11월 21일
The expression sin(x)^2 is equivalent to the mathematical notation
, if I have interpreted your syntax 'sin square x' correctly. However, if there is any misunderstanding, please provide the proper mathematical notation using LaTeX to avoid ambiguity.

Walter Roberson
2023년 11월 21일
syms x
char(sin(x)^2)

char(sin(x)*sin(x))

char(sin(x^2))

char(sin(x * x))

추가 답변 (1개)
Steven Lord
2023년 11월 21일
While the usual mathematical notation to compute the square of the sine of x is
, the MATLAB code to perform that computation is sin(x)^2 (or, since you likely want to compute the square of the sine element-wise, sin(x).^2).

x = 0:pi/4:2*pi
sin(x).^2
You cannot put the squaring operator between the name of the function (sin) and its input argument x.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!