当前位置:网站首页>Introduction to MATLAB drawing functions ezplot explanation
Introduction to MATLAB drawing functions ezplot explanation
2022-08-02 15:32:00 【Yang Lao head soft work】
I. Introduction
The ezplot command can be used to draw the graph of the explicit function, the graph of the implicit function, or the graph of the function determined by the parameter equation, and the system will automatically add the title of the graph, xaxis labels.While fplot is mainly used to draw graphs of explicit functions and functions determined by parametric equations, fimplicit is mainly used to draw graphs of implicit functions.So from a functional point of view, ezplot covers the fplot and fimplicit functions.However, it is not as convenient as fplot and fimplicit to use ezplot to set the color and other attributes of primitives, and you need to use set to set them.If multiple curves are drawn in a graphics window, the system automatically assigns the last function to be the title of the graph, resulting in ambiguity. You need to manually use the title command to add the title.
Second, the basic syntax of ezplot
1) Draw the graphics of the explicit function (I):
ezplot( function, interval )
Its function is to draw the graph of the explicit function function on the interval interval. When the interval is default, the interval is -2π < x < 2π .The format of interval is [ min, max ].
2) Drawing the graph of the explicit function (II):
ezplot( @(varible)function, interval )
The parameter variable variable is explicitly specified.Its function is to draw the graph of the explicit function function with varible as the independent variable on the interval interval. When the interval is default, the interval is -2π < x < 2π .The format of interval is [ min, max ].
3) Draw the graph of the implicit function (I):
ezplot( function, xyinterval )
Its function is to draw the graph of the implicit function determined by the equation function=0 on the interval xyinterval. When xyinterval is default, the interval is -2π < x < 2π , -2π < y < 2π .The format of xyinterval is
[ xmin, xmax, ymin, ymax ].
4) Draw the graph of the implicit function (II):
ezplot( @(varibles)function, xyinterval )
Its function is to draw the graph of the implicit function with varibles as 2 variables and determined by the equation function=0 on the interval xyinterval. When xyinterval is default, the interval is -2π < x < 2π , -2π < y< 2π .The format of xyinterval is [ xmin, xmax, ymin, ymax ].
5) Plot the graph of the parametric equation to determine the function (I):
ezplot( xfun, yfun, tinterval )
Its function is to draw the graph of the function determined by the equation xfun=0, yfun=0 on the interval tinterval to which the parameter belongs. When tinterval is default, the interval is 0 < t < 2π.
6) Plot the graph of the parametric equation to determine the function (II):
ezplot( @(variable)xfun, @(variable)yfun, tinterval )
The parameter variable variable is explicitly specified.Its function is to draw the graph of the function determined by the equation xfun=0, yfun=0 on the interval tinterval to which the parameter belongs. When tinterval is default, the interval is 0 < t < 2π.
3. Specific examples
Example 1. Draw the curve of the function y=sin(x).
% sample codeh = ezplot( 'sin(x)', [ 0, 2 * pi ] );set( h, 'LineStyle', '-.', 'color', 'r', 'LineWidth', 2 );% set primitive properties
%Running result
Example 2. Drawing functionThe curve of y=sin(1/x).
% sample codeezplot( @(x)sin(1./x) );
%Running Results
Example 3. Drawing equationThe curve represented by x^2 + y^2 = 1.
% sample codeezplot( @(x,y)x.^2 + y.^2 - 1, [ -1, 1, -1, 1 ]);axis equalaxis( [ -1.5, 1.5, -1.5, 1.5 ] )
%Running result
Example 4. Draw byThe curve represented by the parametric equation x=ρcos(t),y = ρsin(t).
% sample codeezplot( @(t)cos(t), @(t)sin(t), [ 0, 2*pi ]);axis equalaxis( [ -1.5, 1.5, -1.5, 1.5 ] )
% Run result
Example 5. In aThe graphics window plots the functions y=sin(x) and y=cos(x).
% sample codeezplot( 'sin(x)', [ 0, 2 * pi ] );hold onezplot( 'cos(x)', [ 0, 2 * pi ] );
% running results (the title of the figure only shows cos(x) at this time)
If the code is modified to:
ezplot( 'sin(x)', [ 0, 2 * pi ] );hold onezplot( 'cos(x)', [ 0, 2 * pi ] );title( 'sin(x), cos(x)' );
There is an output:
边栏推荐
猜你喜欢
In-depth understanding of Golang's Map
Win10 Settings screen out from lack of sleep?Win10 set the method that never sleep
mysql的索引结构为什么选用B+树?
Win10安装了固态硬盘还是有明显卡顿怎么办?
网络安全抓包
IPV4和IPV6是什么?
STM32LL库使用——SPI通信
Win7 encounters an error and cannot boot into the desktop normally, how to solve it?
Win11没有本地用户和组怎么解决
Impressions of Embrace Jetpack
随机推荐
CMAKE
推开机电的大门《电路》(二):功率计算与判断
Do Windows 10 computers need antivirus software installed?
发布模块到npm应该怎么操作?及错误问题解决方案
Redis常见面试题
win10 system update error code 0x80244022 how to do
Win10 computer can't read U disk?Don't recognize U disk how to solve?
开心一下,9/28名场面合集
Win11 system cannot find dll file how to fix
DP4056电源保护芯片锂电池pin对pinTP4056
2.4G无线小模块CI24R1超低成本
ECP2459耐压60V降压BUCK电路用于WIFI模块供电方案原理图
Win11系统找不到dll文件怎么修复
PHY6222蓝牙5.2支持MESH组网M0内核超低功耗
Publish module to NPM should be how to operate?Solutions to problems and mistake
[STM32 Learning 1] Basic knowledge and concepts are clear
KiCad常用快捷键
General code for pytorch model to libtorch and onnx format
Please make sure you have the correct access rights and the repository exists. Problem solved
What is Win10 God Mode for?How to enable God Mode in Windows 10?