matlab编程画分段函数,matlab画分段函数 求程序「建议收藏」

matlab编程画分段函数,matlab画分段函数 求程序「建议收藏」你好,你的问题好像没太描述清楚。分段函数绘图实际很简单,我给你举个例子吧。分段函数如下:对该函数绘图,首先应该利用matlab建一个函数ff(x),如下:functionY=ff(X)ifX<0;Y=sin(X);elseif(X>=0&&X<10);Y=X.^2*cos(X)/100;elseY=sin(X).*X;endendmatlab中二维绘…

大家好,又见面了,我是你们的朋友全栈君。

你好,你的问题好像没太描述清楚。

分段函数绘图实际很简单,我给你举个例子吧。

分段函数如下:

0b2fe604b2a39dbc368b41a8ac34b245.gif

对该函数绘图,首先应该利用matlab建一个函数ff(x),如下:function Y = ff(X)

if X<0;

Y=sin(X);

elseif (X>=0 && X<10);

Y=X.^2*cos(X)/100;

else

Y=sin(X).*X;

end

end

matlab中二维绘图函数很多,但我个人认为分段函数采用ezplot较为简单。绘制方法如下:ezplot(@(x,y)ff(x)-y)

colormap([0 0 1])  %%设置直线颜色为蓝色。

绘制结果如下:

5b6bf5165e774498fabfba077af78184.png

ezplot简介(具体看帮助文档 doc ezplot)

Syntax

ezplot(fun)

ezplot(fun,[xmin,xmax])

ezplot(fun2)

ezplot(fun2,[xymin,xymax])

ezplot(fun2,[xmin,xmax,ymin,ymax])

ezplot(funx,funy)

ezplot(funx,funy,[tmin,tmax])

ezplot(…,figure_handle)

ezplot(axes_handle,…)

h = ezplot(…)

Description

ezplot(fun) plots the expression fun(x) over the default domain -2π 

fun can be a function handle or a string.

ezplot(fun,[xmin,xmax]) plots fun(x) over the domain: xmin 

For an implicit function, fun2(x,y):

ezplot(fun2) plots fun2(x,y) = 0 over the default domain -2π 

ezplot(fun2,[xymin,xymax]) plots fun2(x,y) = 0 over xymin 

ezplot(fun2,[xmin,xmax,ymin,ymax]) plots fun2(x,y) = 0 over xmin 

ezplot(funx,funy) plots the parametrically defined planar curve funx(t) and funy(t) over the default domain 0 

ezplot(funx,funy,[tmin,tmax]) plots funx(t) and funy(t) over tmin 

ezplot(…,figure_handle) plots the given function over the specified domain in the figure window identified by the handle figure.

ezplot(axes_handle,…) plots into the axes with handle axes_handle instead of the current axes (gca).

h = ezplot(…) returns the handle to all the plot objects in h.

参考资料:

matlab 帮助文档

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/130546.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 《深入理解mybatis原理》 MyBatis缓存机制的设计与实现

    《深入理解mybatis原理》 MyBatis缓存机制的设计与实现本文主要讲解MyBatis非常棒的缓存机制的设计原理,给读者们介绍一下MyBatis的缓存机制的轮廓,然后会分别针对缓存机制中的方方面面展开讨论。

    2022年5月11日
    45
  • 提问智慧的oracle问题

    提问智慧的oracle问题提问的智慧Oracle版0。尝试在google,论坛,metalink,onlinedocument里搜索。1。写清楚你的执行log,报错信息,写清楚DBversion,OS 2。Instance方面的问题,请贴出alertlog3。network的问题,贴出server的listener.ora,sqlnet.ora并运行lsnrctlservice,贴出cl

    2022年7月26日
    8
  • Unity+Android GET和POST方式的简单实现API请求(人像动漫化)

    Unity+Android GET和POST方式的简单实现API请求(人像动漫化)Unity与Android的简单交互,Unity打开Android相册并调用

    2022年9月19日
    2
  • django csdn_怎么使用cookie登录

    django csdn_怎么使用cookie登录前言cookie:在网站中,http请求是无状态的。也就是说即使第一次和服务器连接后并且登录成功后,第二次请求服务器依然不能知道当前请求是哪个用户。cookie的出现就是为了解决这个问题,第一次登录

    2022年7月30日
    10
  • 《架构之美》笔记_印象笔记如何创建目录

    《架构之美》笔记_印象笔记如何创建目录美是创造矛盾并解决矛盾。架构的多关注点(例如业务逻辑、系统扩展性、持久、并发)和简洁性就是一种矛盾,美丽的架构能解决这种矛盾,使人内心产生愉悦;随着关注点的增加,架构也在不断演进;术:分层、组件化、服务化、标准化、缓存、分离、队列、复制、冗余、代理;道:如何恰到好处地使用术,例如顿悟变化的道理、博弈中寻找平衡、相对与绝对的奥秘、开放的心态;爱因斯坦说:『让它尽可能简单,但不要过于简单』,美

    2025年6月10日
    4
  • Android listView长按删除

    Android listView长按删除AndroidlistView长按删除

    2022年7月22日
    20

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号