Write a user defined function to implement the following mathematical function :

1 ビュー (過去 30 日間)
Majid Alomari
Majid Alomari 2020 年 10 月 21 日
回答済み: David Hill 2020 年 10 月 21 日
Write a user defined function to implement the following mathematical function : please note that x is angle in degrees.
f (x) = cos (x) if 0 < x < 90
f(x)= sin(x) if 90 < x < 180
f(x)=tan(x) otherwise

回答 (1 件)

David Hill
David Hill 2020 年 10 月 21 日
function y = f(x)
if x>0&&x<90
y=cosd(x);
elseif x>90&&x<180
y=sind(x);
else
y=tand(x);
end

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by