声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1606|回复: 4

[编程技巧] [求助]小学生求解问题

[复制链接]
发表于 2005-11-3 19:57 | 显示全部楼层 |阅读模式

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

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

x
偶是初来者,没有学过matlab,但想请教学长们问题:
已知x,y满足方程:
x=y*(1/(0.1-a*y))^a;
其中a=2.44;x为一向量[0:0.2:5];
怎样能求出y的值,并画图呢?
多谢!
回复
分享到:

使用道具 举报

发表于 2005-11-3 19:59 | 显示全部楼层
这是隐函数绘图问题,见帖子
http://forum.vibunion.com/thread-3606-1-1.html
 楼主| 发表于 2005-11-3 21:07 | 显示全部楼层
不太懂啊
发表于 2005-11-4 15:28 | 显示全部楼层
调用上面连接里的子程序画图就行了
 楼主| 发表于 2005-11-5 00:01 | 显示全部楼层
请教系主任
是调用这个程序吗:可是我看不懂啊,试了一下下面这个原程序好像说有问题啊
  1. function implot(fun,rangexy,ngrid)
  2. % Implicit plot function
  3. % function implot(fun,rangexy,ngrid)
  4. % fun is 'inline' function f(x,y)=0 (Note function written as equal to zero)
  5. % rangexy =[xmin,xmax,ymin,ymax] range over which x and y is ploted default(-2*pi,2*pi)
  6. % ngrid is the number of grid points used to calculate the plot,
  7. % Start with course grid (ngrid =20) and then use finer grid if necessary
  8. % default ngrid=50
  9. %
  10. % Example
  11. % Plot y^3+exp(y)-tanh(x)=0
  12. %
  13. % write function f as an 'inline' function of x and y-- right hand side
  14. % equal to zero
  15. %
  16. % f=inline('y^3+exp(y)-tanh(x)','x','y')
  17. % implot(f,[-3 3 -2 1])
  18. % A.Jutan UWO 2-2-98 ajutan@julian.uwo.ca

  19. if nargin == 1 ;% grid value and ranges not specified calculate default
  20. rangexy=[-2*pi,2*pi,-2*pi,2*pi];
  21. ngrid=50;
  22. end


  23. if nargin == 2; % grid value not specified
  24. ngrid=50;
  25. end

  26. % get 2-D grid for x and y

  27. xm=linspace(rangexy(1),rangexy(2),ngrid);
  28. ym=linspace(rangexy(3),rangexy(4),ngrid);
  29. [x,y]=meshgrid(xm,ym);
  30. fvector=vectorize(fun);% vectorize the inline function to handle vectors of x y
  31. fvalues=feval(fvector,x,y); %calculate with feval-this works if fvector is an m file too
  32. %fvalues=fvector(x,y); % can also calculate directly from the vectorized inline function
  33. contour(x,y,fvalues,[0,0],'b-');% plot single contour at f(x,y)=0, blue lines
  34. xlabel('x');ylabel('y');
  35. grid
复制代码

能讲解一下吗,谢谢指教!
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

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

GMT+8, 2024-5-7 14:42 , Processed in 0.050715 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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