matlab用ezplot生成的曲线如何提取数据。
Show older comments
通过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 = []
Answers (0)
Categories
Find more on 图形对象的标识 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!