声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 2004|回复: 8

[绘图技巧] 求助:隐函数画图问题

[复制链接]
发表于 2006-6-8 10:49 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
形如
(x^2-y^2th(0.2y))tan(0.4x)-xy(1+th(0.2y))=0
的式子用 ezplot画出来的曲线为什么是杂乱的好多条呢?
怎么才可以画成一条呢?
回复
分享到:

使用道具 举报

发表于 2006-6-8 12:13 | 显示全部楼层
ding ~~
 楼主| 发表于 2006-6-8 14:55 | 显示全部楼层
请各位高手帮帮忙,急用
发表于 2006-6-8 18:28 | 显示全部楼层
以前有人编的
function implot(fun,rangexy,ngrid)
% Implicit plot function
% function implot(fun,rangexy,ngrid)
% fun is 'inline' function f(x,y)=0 (Note function written as equal to zero)
% rangexy =[xmin,xmax,ymin,ymax] range over which x and y is ploted default(-2*pi,2*pi)
% ngrid is the number of grid points used to calculate the plot,
% Start with course grid (ngrid =20) and then use finer grid if necessary
% default ngrid=50
%
% Example
% Plot y^3+exp(y)-tanh(x)=0
%
% write function f as an 'inline' function of x and y-- right hand side equal to zero
%
% f=inline('y^3+exp(y)-tanh(x)','x','y')% implot(f,[-3 3 -2 1])
% A.Jutan UWO 2-2-98 ajutan@julian.uwo.ca
if nargin == 1 ;% grid value and ranges not specified calculate default
rangexy=[-2*pi,2*pi,-2*pi,2*pi];
ngrid=50;
end
if nargin == 2; % grid value not specified
ngrid=50;
end% get 2-D grid for x and y
xm=linspace(rangexy(1),rangexy(2),ngrid);
ym=linspace(rangexy(3),rangexy(4),ngrid);
[x,y]=meshgrid(xm,ym);
fvector=vectorize(fun);% vectorize the inline function to handle vectors of x y
fvalues=feval(fvector,x,y); %calculate with feval-this works if fvector is an m file too
%fvalues=fvector(x,y); % can also calculate directly from the vectorized inline function
contour(x,y,fvalues,[0,0],'b-');
% plot single contour at f(x,y)=0, blue lines
xlabel('x');
ylabel('y');
grid
发表于 2006-6-25 17:44 | 显示全部楼层
告诉你你区间没选对,因为你画的很可能是多值的
发表于 2006-6-26 08:22 | 显示全部楼层
比如?举个例看看
这个也不是我写的,没怎么仔细去看
发表于 2006-6-26 13:44 | 显示全部楼层
如果区间设置为:rangexy=[-2*pi,2*pi,-2*pi,2*pi],则图形1如下:

如果区间设置为:rangexy=[0,5,0,4.5],则图形2如下:
1.jpg
2.jpg
发表于 2006-6-26 13:49 | 显示全部楼层
发表于 2006-8-18 17:08 | 显示全部楼层
好像在那个版有类似的帖子,楼主搜一下
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-20 15:42 , Processed in 0.059051 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表