フィルターのクリア

How do I define a function that evaluates in input

2 ビュー (過去 30 日間)
aldburg
aldburg 2017 年 11 月 17 日
コメント済み: aldburg 2017 年 11 月 17 日
Currently been typing:
theta_Degree=40
theta=(theta_Degree*pi/180)
T = [cos(theta)^2 sin(theta)^2 2*cos(theta)*sin(theta);
sin(theta)^2 cos(theta)^2 -2*cos(theta)*sin(theta);
-cos(theta)*sin(theta) cos(theta)*sin(theta) cos(theta)^2-sin(theta)^2]
But I'd like to simply type T(theta) from saved script but I can't seem to figure out how to.

採用された回答

Birdman
Birdman 2017 年 11 月 17 日
function y=T(theta_Degree)
theta=theta_Degree*pi/180;
y=[cos(theta)^2 sin(theta)^2 2*cos(theta)*sin(theta);sin(theta)^2 cos(theta)^2 -2*cos(theta)*sin(theta);-cos(theta)*sin(theta) cos(theta)*sin(theta) cos(theta)^2-sin(theta)^2];
end
Then type in command line
T(40)
and see the results.
  1 件のコメント
aldburg
aldburg 2017 年 11 月 17 日
Thank you very much! Just started learning Matlab and I appreciate the help.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by