matlab给三个点建立三维方程,如何在matlab中绘制含有三个参数方程的三维图形 - 计算模拟 - 小木虫 - 学术 科研 互动社区...

�1】ezimplot3 存储该M文件,并将文件路径设置为matlab当前路径

function h = ezimplot3(fun,domain,n,color)

% EZIMPLOT3    Easy to use 3D implicit plotter.

%   EZIMPLOT3(FUN) plots the inline function FUN(X,Y,Z) = 0 over the

%   default domain -2*PI < X < 2*PI, -2*PI < Y < 2*PI, -2*PI < Z < 2*PI.

%

%   EZIMPLOT3(FUN,DOMAIN)plots FUN over the specified DOMAIN instead of the

%   default domain. DOMAIN can be the vector [XMIN,XMAX,YMIN,YMAX,ZMIN,ZMAX]

%   or the vector [A,B] (to plot over A < X < B, A < Y < B, A < Z < B).

%

%   EZIMPLOT3(...,N) plots FUN over the default domain using an N-by-N grid.

%   The default value for N is 60.

%

% Example

% Plot x^3+exp(y)-cosh(z)=4

%

% via a string: f='x^3+exp(y)-cosh(z)-4'

% ezimplot3(f)

%

% via a vectorized function handle: f = @(x,y,z) x.^3+exp(y)-cosh(z)-4

% ezimplot3(f)

%

% Note: this function do not use the ezgraph3 standard, like ezsurf, ezmesh

% ,etc, does. Because of that, ezimplot3 only tries to imitate that

% interface. A future work must be to modify the ezgraph3 to include a

% routine for implicit surfaces based on this file

%

%   Inspired by works of:   A.Jutan     UWO 02-02-98 ajutan@julian.uwo.ca

%   Made by:                G.Morales   UC  03-20-09 gmorales@uc.edu.ve

%

if nargin == 1

domain = [-2*pi, 2*pi];             % default domain: -2*pi < xi < 2*pi

n = 60;                             % default grid size

elseif nargin == 2

n = 60;                             % just default grid

end

if  size(domain,2) == 2

domain = repmat(domain,1,3);        %domain repeated in all variables

end

xm = linspace(domain(1), domain(2), n); % generating the volume data

ym = linspace(domain(3), domain(4), n);

zm = linspace(domain(5), domain(6), n);

[x,y,z] = meshgrid(xm, ym, zm);

if ischar(fun)

fun = inline(vectorize(fun)); % making sure string "fun" is vectorized

fvalues = feval(fun,x,y,z);         % evaluating "fun" in domain

elseif isa(fun,'function_handle')

fvalues = fun(x,y,z);               % evaluating "fun" in domain

fun = char(fun); fun = fun(9:end);  % pre-formatting of graph title

end

h = patch(isosurface(x,y,z, fvalues, 0)); %"patch" handles the structure

%sent by "isosurface"

isonormals(x,y,z,fvalues,h) %Recalculating the isosurface normals based on

%the volume data

set(h,'FaceColor','red','EdgeColor','none');

xlabel('x');ylabel('y');zlabel('z');% naming the axis

alpha(0.8) % adjusting for some transparency

grid on

view(3)

axis equal

camlight

lighting gouraud

title([strrep(char(fun),'.','') ' = 0']); % graph title without "."

【2】在matlab命令窗口中输入

f='x-y*(y+1)*(z^(-2)-z^(-8))*x^2+(y+1)^2*(z^2-z^(-4))^3/100'

这里c我给取了10,所以c^2=100,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值