24小时热门版块排行榜    

查看: 3475  |  回复: 6

shengjunjie

木虫 (正式写手)

[交流] 如何在matlab中绘制含有三个参数方程的三维图形 已有1人参与

如下面公式

对matlab不是很熟悉,想根据这个公式绘制如下三维图,其中c是常数,可以去1或者100、1000等,该如何编程,谢谢


[ Last edited by shengjunjie on 2011-4-15 at 09:33 ]
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

好好学习,多运动,多发Paper...
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

杨小胖

金虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖
【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
人生中最辉煌的不是功成名就的时候,而是在失败和挫折中看到希望并为之奋斗的日子
2楼2011-04-21 09:41:30
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

杨小胖

金虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖
如图。
好像渲染的效果需要改进。
楼主大致看看,借鉴一下。

人生中最辉煌的不是功成名就的时候,而是在失败和挫折中看到希望并为之奋斗的日子
3楼2011-04-21 09:44:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

shengjunjie

木虫 (正式写手)

引用回帖:
Originally posted by 杨小胖 at 2011-04-21 09:44:06:
如图。
好像渲染的效果需要改进。
楼主大致看看,借鉴一下。

非常感谢,辛苦了
好好学习,多运动,多发Paper...
4楼2011-04-21 09:48:33
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

shengjunjie

木虫 (正式写手)

引用回帖:
Originally posted by 杨小胖 at 2011-04-21 09:41:30:
【1】ezimplot3 存储该M文件,并将文件路径设置为matlab当前路径
function h = ezimplot3(fun,domain,n,color)
% EZIMPLOT3    Easy to use 3D implicit plotter.
%   EZIMPLOT3(FUN) plots the inline functi ...

运行的时候,这个地方有问题怎么?
能否发邮箱m文件,不胜感激。
scu2005sjj@163.com
好好学习,多运动,多发Paper...
5楼2011-04-21 09:56:52
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

杨小胖

金虫 (正式写手)


小木虫(金币+0.5):给个红包,谢谢回帖
上面的m文件来自小木虫
http://muchong.com/html/201006/2180805.html
人生中最辉煌的不是功成名就的时候,而是在失败和挫折中看到希望并为之奋斗的日子
6楼2011-04-21 12:37:10
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

shengjunjie

木虫 (正式写手)

引用回帖:
Originally posted by 杨小胖 at 2011-04-21 12:37:10:
上面的m文件来自小木虫
http://muchong.com/html/201006/2180805.html

辛苦啦,明白啦,感激中
好好学习,多运动,多发Paper...
7楼2011-04-22 12:41:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 shengjunjie 的主题更新
普通表情 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] NSFC申报书里申请人简历中代表性论著还需要在申报书最后的附件里面再上传一遍吗 20+5 NSFC2026我来了 2026-03-10 14/700 2026-03-15 23:53 by 不负韶华的虎
[考研] 求老师收留调剂 +4 jiang姜66 2026-03-14 5/250 2026-03-15 20:11 by Winj1e
[考研] 294求调剂 +3 Zys010410@ 2026-03-13 4/200 2026-03-15 10:59 by zhq0425
[考研] 309求调剂 +4 花与叶@ 2026-03-10 4/200 2026-03-14 21:26 by a不易
[考研] 材料与化工(0856)304求B区调剂 +7 邱gl 2026-03-10 11/550 2026-03-14 12:18 by 邱gl
[考研] 材料080500调剂求收留 +3 一颗meteor 2026-03-13 3/150 2026-03-14 10:54 by peike
[考研] 333求调剂 +3 球球古力 2026-03-09 3/150 2026-03-14 01:57 by JourneyLucky
[考研] 考研材料与化工,求调剂 +8 戏精丹丹丹 2026-03-09 8/400 2026-03-14 01:14 by JourneyLucky
[考研] 求调剂,一志愿江南大学环境工程085701 +3 Djdjj12 2026-03-10 4/200 2026-03-14 00:31 by JourneyLucky
[考研] 308求调剂 +3 是Lupa啊 2026-03-10 3/150 2026-03-14 00:30 by JourneyLucky
[考研] 311求调剂 +8 zchqwer 2026-03-10 8/400 2026-03-14 00:01 by JourneyLucky
[考研] 341求调剂 +4 番茄头--- 2026-03-10 4/200 2026-03-13 23:12 by JourneyLucky
[考研] 308求调剂 +5 是Lupa啊 2026-03-11 5/250 2026-03-13 22:13 by JourneyLucky
[考研] 332求调剂 +3 Zz版 2026-03-13 3/150 2026-03-13 20:36 by 18595523086
[考研] 302求调剂 +6 负心者当诛 2026-03-11 6/300 2026-03-13 16:11 by JourneyLucky
[考研] 材料301分求调剂 +5 Liyouyumairs 2026-03-12 5/250 2026-03-13 14:42 by JourneyLucky
[考研] 26考研求调剂 +5 丶宏Sir 2026-03-13 5/250 2026-03-13 13:05 by JourneyLucky
[考研] 08食品或轻工求调剂,本科发表3篇sci一区top论文,一志愿南师大食品科学与工程 +3 我是一个兵, 2026-03-10 3/150 2026-03-13 10:21 by Yuyi.
[考博] 福州大学杨黄浩课题组招收2026年专业学位博士研究生,2026.03.20截止 +3 Xiangyu_ou 2026-03-12 3/150 2026-03-13 09:36 by duanwu655
[考研] 321求调剂(食品/专硕) +3 xc321 2026-03-12 6/300 2026-03-13 08:45 by xc321
信息提示
请填处理意见