首页 > 编程知识 正文

matlab中双曲正切函数,matlab反双曲余弦函数

时间:2023-05-06 14:08:14 阅读:237790 作者:2196

第二,输入以下代码,绘制双曲正切函数tanh、双曲余切函数coth的图像。

close all; clear all; clc

x = -pi:0.5:pi;

y_tanh = tanh(x); % 双曲正切函数

y_coth = coth(x); % 双曲余切函数

figure(1);plot(x,y_tanh,'r-','LineWidth',3);legend('tanh');

line([-pi,pi],[1,1]);line([-pi,pi],[-1,-1]);axis([-pi,pi,-2,2]);

figure(2);plot(x,y_coth,'g-','LineWidth',3);legend('coth');

line([-pi,pi],[1,1]);line([-pi,pi],[-1,-1]);axis([-pi,pi,-10,10]);

figure(3);

plot(x,y_tanh,'r-','LineWidth',3);hold on

plot(x,y_coth,'g-','LineWidth',3);hold off

legend('tanh','coth');

line([-pi,pi],[1,1]);line([-pi,pi],[-1,-1]);

axis([-pi,pi,-10,10]);

xlabel('x');ylabel('y');

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。