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 帮助文档

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

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

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • ubuntu命令行安装deb_ubuntu命令行安装deb软件

    ubuntu命令行安装deb_ubuntu命令行安装deb软件1、下载需要安装的deb包,输入以下命令安装:$sudodpkg-ipackage.deb2、查看package.deb包中的内容:$dpkg-cpackage.deb3、从package.deb包中提取信息:$dpkg-Ipackage.deb4、移除安装的deb包:$dpkg-rpackage5、…

    2022年10月21日
  • Jenkins 系列教程-史上最简单Jenkins教程,教你一天学会使用Jenkins利器「建议收藏」

    Jenkins 系列教程-史上最简单Jenkins教程,教你一天学会使用Jenkins利器「建议收藏」一、安装Git安装yum命令安装:yuminstall-ygit安装结果验证:git–versionNode安装(非必须)链接:Centos安装nodejsMaven安装文档:链接:Centos安装MavenJDK安装链接:Linux下安装javaJDK&部署ZookeeperJenKins安装jenkins官网:https://www.jenkins.io/zh/访问Jenkins的官方网站的downdolad

  • linux——挖矿程序处理

    linux——挖矿程序处理记一次挖矿程序入侵以及解决实操!1,过程记录系统被挖矿程序入侵,导致系统CPU飙升。kill掉进程后自动重启。无论kill-9还是直接把系统中nanoWatch所对应的进程文件删除,一样会定时重启。使用crontab-e查看当前系统的定时任务信息,如下:显示定时从链接中下载文件,于是在浏览器中访问该地址,下载的文件截图如下:很明显,这是一个恶意脚本,定时检查…

  • thinkphp无法加载控制器:Admin

    thinkphp无法加载控制器:Admin

  • group by 和 order by 的区别 + 理解过程

    group by 和 order by 的区别 + 理解过程orderby和groupby的区别order by 和 group by 的区别:1,order by 从英文里理解就是行的排序方式,默认的为升序。 order by 后面必须列出排序的字段名,可以是多个字段名。2,group by 从英文里理解就是分组。必须有“聚合函数”来配合才能使用,使用时至少需要一个分组标志字段。注意:聚合函数是—sum()、count()、…

  • oh my zsh配置_setlanguage?lang=classic-zh-cn

    oh my zsh配置_setlanguage?lang=classic-zh-cn什么是Shell?相对于内核来说,Shell是Linux/Unix的一个外壳,它负责外界与Linux内核的交互,接收用户或其他应用程序的命令,然后把这些命令转化成内核能理解的语言,传给内核,内核是真

发表回复

您的电子邮箱地址不会被公开。

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