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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 【转载】视频跟踪的研究

    首先,什么是视频跟踪?基于视频的运动目标跟踪技术作为计算机视觉领域的核心研究课题之一, 主要目的是模仿生理视觉系统的运动感知功能,通过对摄像头捕捉到的图像序列进行分析,计算出运动目标在每一帧图像中的二维坐标位置;然后,根据运动目标相关的特征值,将图像序列中连续帧间的同一运动目标关联起来,得到每帧图像中目标的运动参数以及相邻帧图像间运动目标的对应关系,从而得到各个运动目标完整的运动轨迹,即在

    2022年4月10日
    39
  • 浅析C++中的this指针[通俗易懂]

    浅析C++中的this指针[通俗易懂]    有下面的一个简单的类:class CNullPointCall{public:    static void Test1();    void Test2();    void Test3(int iTest);    void Test4();private:    static int m_iStatic;    int m_iTest;};int CNullPointCal

    2022年5月17日
    33
  • 客户端接收发邮件时,出现“无法连接到服务器

    客户端接收发邮件时,出现“无法连接到服务器

    2021年9月21日
    88
  • 0xFFFFFFFF 为什么表示-1

    0xFFFFFFFF 为什么表示-1负数的补码是:原码按位取反再加一逆序求原码:-1的补码是FFFF=1111111111111111减一:1111111111111110按位取反(除符号位):1000000000000001最高位1表示符号位,"0"表示正数"1"表示负数=========补充原码是不用求的。原码就是没有修改过的嘛。对于signedin…

    2022年5月13日
    71
  • 帝国时代之国家崛起_崛起于帝国时代

    帝国时代之国家崛起_崛起于帝国时代01关系数据库帝国现在是公元2009年,关系帝国已经统治了我们30多年,实在是太久了。1970年,科德提出关系模型,1974年张伯伦和博伊斯制造出了SQL,帝国迅速建立起了统治。从北美到…

    2022年9月24日
    0
  • java中判断字符串是否日期格式的方法建议收藏

    大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。此处内容已经被作者隐藏,请输入验证码查看内容验证码:请关注本站微信公众号,回复“验证码”,获取验证码。在微信里搜索“全…

    未分类 2021年12月18日
    56

发表回复

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

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