matlab用ezp​lot生成的曲线如何​提取数据。

5 次查看(过去 30 天)
果搏东方在线【gb9905 .com】
通过ezplot画出了x和y相关的二元隐函数曲线,想提取曲线上的数据,网上查到的findall和findobj命令均出现问题,我想请问下如何写程序以提取曲线上的点呢?下附隐函数和两个得到错误结果的程序的code:
ezplot('-(x)^4/6.86^4 - (y)^4/15.32^4+(x)^2/4.84^2 +(y)^2/8.47^2= 1',[-7 7 -10 10]);  %二元隐函数
程序1:
lh=findall(gca,'type','line');   % 从当前图(gca)中取出曲线的handle
xc=get(lh,'xdata');   % 取出x轴数据
yc=get(lh,'ydata');   % 取出y轴数据
x=xc{1};  %从cell转换成矩阵
y=yc{1};
结果:元胞内容引用自非元胞数组对象。
程序2:
h = findobj(gca,'Type','line');
xdata=get(h,'XData');
ydata=get(h,'YData')
结果:ydata = []

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 图形对象的标识 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!