当前位置:网站首页>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:
边栏推荐
- cmake配置libtorch报错Failed to compute shorthash for libnvrtc.so
- Golang 垃圾回收机制详解
- 为vscode配置clangd
- 推开机电的大门《电路》(二):功率计算与判断
- Failed to install using npx -p @storybook/cli sb init, build a dedicated storybook by hand
- Win7 encounters an error and cannot boot into the desktop normally, how to solve it?
- DP1332E内置c8051的mcu内核NFC刷卡芯片国产兼容NXP
- General code for pytorch model to libtorch and onnx format
- 二叉树遍历之后序遍历(非递归、递归)入门详解
- MATLAB图形加标注的基本方法入门简介
猜你喜欢
Win11 system cannot find dll file how to fix
Network Security Packet Capture
Redis的线程模型
word方框怎么打勾?
How to set the win10 taskbar does not merge icons
Mysql lock
Win11 computer off for a period of time without operating network how to solve
The SSE instructions into ARM NEON
Win10上帝模式干嘛的?Win10怎么开启上帝模式?
Win10 cannot directly use photo viewer to open the picture
随机推荐
ECP2459耐压60V降压BUCK电路用于WIFI模块供电方案原理图
MATLAB绘图函数fplot详解
编译error D8021 :无效的数值参数“/Wextra” cl command line error d8021 invalid numeric argument ‘/wextra‘
Impressions of Embrace Jetpack
vscode镜像
模板系列-二分
发布模块到npm应该怎么操作?及错误问题解决方案
用U盘怎么重装Win7系统?如何使用u盘重装系统win7?
2021-10-14
PHY6222蓝牙5.2支持MESH组网M0内核超低功耗
win10无法直接用照片查看器打开图片怎么办
CI24R1小模块2.4G收发模块无线通信低成本兼容si24r1/XN297超低功耗
基于最小二乘法的线性回归分析方程中系数的估计
How to update Win11 sound card driver?Win11 sound card driver update method
[STM32 Learning 1] Basic knowledge and concepts are clear
How to simulate 1/3 probability with coins, and arbitrary probability?
奇技淫巧-位运算
KiCad Common Shortcuts
FP7122降压恒流内置MOS耐压100V共正极阳极PWM调光方案原理图
Lightweight AlphaPose