How to type sin function with square
85 ビュー (過去 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545332/image.png)
Walter Roberson
2023 年 11 月 21 日
syms x
char(sin(x)^2)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545422/image.png)
char(sin(x)*sin(x))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545427/image.png)
char(sin(x^2))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545432/image.png)
char(sin(x * x))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545437/image.png)
その他の回答 (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).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1545697/image.png)
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Function Creation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!