资源简介
该程序适用于用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傅里叶变换程序
- bpsk qpsk 16qam 的ber方针matlab
- MATLAB时域有限差分法程序
- 基于MATLAB的三电平逆变模型研究
- 北斗三号B1C weil码生成Matlab程序
- matlab实现手动抠图 m文件
- 路径规划蚁群算法
- MATLAB中小波用于检测奇异点
- matlab 加窗程序
- 自适应模糊控制matlab实现
- 图像分割 CV模型的MATLAB源代码
- 用Matlab处理医学图像:照亮血管边缘
- 三相短路电流计算
- JPEG压缩算法 MATLAB
- 标准合作型协同进化遗传算法matlab源
- 相移光栅matlab仿真程序,双相移点
- logistic映射代码MATLAB
- Matlab实现循环神经网络RNN
- matlab 心脏血管中心线提取
- matlab程序-产生FPGA仿真源数据
- Jakes模型matlab仿真验证过
- 单点定位matlab计算程序
- matlab编写的LBFGS优化算法
- 适合新手学习的简单遗传算法,matl
- FASTICA盲源信号分离代码Matlab(复信号
- 流形学习算法(matlab)
- matlab 分别用sobel prewitt roberts laplacia
- 文献和程序,光伏发电PV,MATLAB程序
- matlab图像分解四叉树分解显示
- 基于Matlab的二阶系统的模糊自适应P
评论
共有 条评论