我们学习常遇见的函数种类有显函数,隐函数,参数方程三种,对于隐函数绘制图像比较麻烦,给大家介绍一种简单实用的一中画函数的方法。
函数介绍
二维曲线ezplot()函数
ezplot()函数用于绘制显函数,隐函数,参数方程二维图像,函数格式
ezplot(f)直接绘制图像
ezplot(f,[min,max]) 指定函数x的值域范围
三维曲线ezplot3()函数
ezplot3()函数用于绘制显函数,隐函数,参数方程三维图像,函数格式
ezplot3(x,y,z,[tmin,tmax]) 参数t范围可以省略
绘制显函数y=sin(x)函数
clear all;
syms x;
y=sin(x);
ezplot(y)
绘制结果
绘制隐函数5*x+7*y+11=0
clear all
syms x y
z=5*x+7*y+11;
ezplot(z)
grid on
绘制结果
绘制参数方程x=2*t,y=sin(t)
clear all
syms x y t
x=2*t;
y=sin(t);
ezplot(x,y)
axis([0,15,-2,2])%设置坐标轴显示范围x[0,15],y[-2,2]
绘制结果
绘制三维参数方程螺旋线x=cos(t),y=sin(t),z=t*t
clear all
syms x y z t
x=cos(t);
y=sin(t);
z=t*t;
ezplot3(x,y,z)
绘制结果
对于ezplot() 函数ezplot3()函数还有好多用法,在此不列举了,后面文章我会介绍函数的详细用法以及画图技巧。