MATLAB演示6种常见的三角函数

时间:2024-10-15 02:45:46

1、第一,输入以下代码,分别演示正弦sin( ),余弦cos( ),正切tan( ),余切cot( ),正割sec( ),余割csc( )六种常见的三角函数,其中定义域为0到4pi(未考虑pi/2,pi等时正切余切无意义即分母为0等情况)。close all; clear all; clct = 0:pi/30:4*pi;y_sin = sin(t); % 正弦函数y_cos = cos(t); % 余弦函数y_tan = tan(t); % 正切函数y_cot = cot(t); % 余切函数y_sec = sec(t); % 正割函数y_csc = csc(t); % 余割函数figure(1);plot(t,y_sin,'r-','LineWidth',3);figure(2);plot(t,y_cos,'g-','LineWidth',3);figure(3);plot(t,y_tan,'y-','LineWidth',3);figure(4);plot(t,y_cot,'b-','LineWidth',3);figure(5);plot(t,y_sec,'k-','LineWidth',3);figure(6);plot(t,y_csc,'c-','LineWidth',3);figure(7);plot(t,y_sin,'r-','LineWidth',3);hold onplot(t,y_cos,'g-','LineWidth',3);plot(t,y_tan,'y-','LineWidth',3);plot(t,y_cot,'b-','LineWidth',3);plot(t,y_sec,'k-','LineWidth',3);plot(t,y_csc,'c-','LineWidth',3);hold offlegend('sin','cos','tan','cot','sec','csc')xlabel('t');ylabel('y');

MATLAB演示6种常见的三角函数

2、第二,保存和运行上述代码,得到正弦sin( )函数图像如下。

MATLAB演示6种常见的三角函数

3、第三,得到余弦cos( )函数图像如下。

MATLAB演示6种常见的三角函数

4、第四,得到正切tan( )函数图像如下。

MATLAB演示6种常见的三角函数

5、第五,得到余切cot( )函数图像如下。

MATLAB演示6种常见的三角函数

6、第六,得到正割sec( )函数图像如下。

MATLAB演示6种常见的三角函数

7、第七,得到余割csc( )函数图像如下。

MATLAB演示6种常见的三角函数

8、最后,把正弦sin( ),余弦co衡痕贤伎s( ),正切tan( ),余切cot( ),正割sec( ),余割csc( )六种常见的三角函数绘制在一张图上,如下。

MATLAB演示6种常见的三角函数
© 手抄报圈