资源简介
该程序适用于用matlab画隐式函数的图,只需要输入函数表达式即可。很方便实用!
代码片段和文件信息
function h = ezimplot3(varargin)
% EZIMPLOT3 Easy to use 3D implicit plotter.
% EZIMPLOT3(FUN) plots the function FUN(XYZ) = 0 (vectorized or not)
% over the default domain:
% -2*PI < X < 2*PI -2*PI < Y < 2*PI -2*PI < Z < 2*PI.
% FUN can be a string an anonymous function handle a .M-file handle an
% inline function or a symbolic function (see examples below)
%
% EZIMPLOT3(FUNDOMAIN)plots FUN over the specified DOMAIN instead of the
% default domain. DOMAIN can be vector [XMINXMAXYMINYMAXZMINZMAX] or
% vector [AB] (to plot over A < X < B A < Y < B A < Z < B).
%
% EZIMPLOT3(..N) plots FUN using an N-by-N grid. The default value for
% N is 60.
% EZIMPLOT3(..‘color‘) plots FUN with color ‘color‘. The default value
% for ‘color‘ is ‘red‘. ‘color‘ must be a valid Matlab color identifier.
%
% EZIMPLOT3(axes_handle..) plots into the axes with handle axes_handle
% instead of into current axes (gca).
%
% H = EZIMPLOT3(...) returns the handle to the patch object this function
% creates.
%
% Example:
% Plot x^3+exp(y)-cosh(z)=4 between -5 and 5 for xy and z
%
% via a string:
% f = ‘x^3+exp(y)-cosh(z)-4‘
% ezimplot3(f[-5 5])
%
% via a anonymous function handle:
% f = @(xyz) x^3+exp(y)-cosh(z)-4
% ezimplot3(f[-5 5])
%
% via a function .m file:
%------------------------------%
% function out = myfun(xyz)
% out = x^3+exp(y)-cosh(z)-4;
%------------------------------%
% ezimplot3(@myfun[-5 5]) or ezimplot(‘myfun‘[-5 5])
%
% via a inline function:
% f = inline(‘x^3+exp(y)-cosh(z)-4‘)
% ezimplot3(f[-5 5])
%
% via a symbolic expression:
% syms x y z
% f = x^3+exp(y)-cosh(z)-4
% ezimplot3(f[-5 5])
%
% Note: this function do not use the “ezgraph3“ standard like ezsurf
% ezmesh etc does. Because of this ezimplot3 only tries to imitate that
% interface. A future work must be to modify “ezgraph3“ to include a
% routine for implicit surfaces based on this file
%
% Inspired by works of: Artur Jutan UWO 02-02-98 ajutan@julian.uwo.ca
% Made by: Gustavo Morales UC 04-12-09 gmorales@uc.edu.ve
%
%%% Checking & Parsing input arguments:
if ishandle(varargin{1})
cax = varargin{1}; % User selected axes handle for graphics
axes(cax);
args{:} = varargin{2:end}; %ensuring args be a cell array
else
args = varargin;
end
[fun domain n color] = argcheck(args{:});
%%% Generating the volumetric domain data:
xm = linspace(domain(1)domain(2)n);
ym = linspace(domain(3)domain(4)n);
zm = linspace(domain(5)domain(6)n);
[xyz] = meshgrid(xmymzm);
%%% Formatting “fun“
[f_handle f_text] = fix_fun(fun); % f_handle is the anonymous f-handle for “fun“
% f_text is “fun“ ready to be a title
%%% Evaluating “f_handle“ in domain:
try
fvalues = f_handle(xyz); % fvalues: volume data
catch ME
error(‘Ezimplot3:Functions‘ ‘FUN must have no more than 3 arguments‘);
end
%%% Making the 3D graph of the 0-level surface of the 4D function “f
相关资源
- matlab_OFDM调制解调(来自剑桥大学)
- Matlab路面裂缝识别69319
- 高灵敏度GPS接收机MATLAB仿真,附捕获
- 基于MATLAB的质点弹道计算与外弹道优
- 阵列天线的matlab仿真
- MATLAB 经典程序源代码大全
- MATLAB小波软阈值去噪代码33473
- 天线阵的波束形成在MATLAB仿真程序及
- 非线性SVM算法-matlab实现
- 《MATLAB 智能算法超级学习手册》-程序
- 组合导航matlab程序
- 读取txt文件内容matlab代码实现
- Matlab实现基于相关的模板匹配程序
- matlab优化工具箱讲解
- 基于MATLAB的快速傅里叶变换
- 光纤传输中的分布傅立叶算法matlab实
- 基于matlab的图像处理源程序
- matlab 椭圆拟合程序
- 算术编码解码matlab源代码
- optical_flow 光流法 matlab 实现程序
- 引导图像滤波器 Matlab实现
- 分形几何中一些经典图形的Matlab画法
- OFDM系统MATLAB仿真代码
- SVM工具箱(matlab中运行)
- 图像小波变换MatLab源代码
- LU分解的MATLAB实现
- 冈萨雷斯数字图像处理matlab版(第三
- 替代数据法的matlab程序
- 用matlab实现的多站定位系统性能仿真
- 通过不同方法进行粗糙集属性约简m
评论
共有 条评论