我正在尝试从 ezplot
中提取数据,但是当我绘制提取的数据时,我没有得到相同的图表(a
和 b
不同)...
谁能详细说明一下出了什么问题吗?
这是代码:
h = @(x,y)(x-((1/0.0175)*(y/5500)*(1+(y/5500)^9)))
a = ezplot(h,[0,700,0,7000]);
t = get(a,'xdata');
M = get(a,'ydata');
theta = transpose(t)
figure
b = plot(theta,M)
ezplot
生成
虽然plot
产生
这是我从轮廓中提取出来的,还是有一条直线3
最佳答案
ezplot
返回一个轮廓对象。要提取 x
和 y
数据,您需要使用 get(a,'contourMatrix')
。那么x
数据将在第一列中,y
数据将在第二列中
t = get(a,'contourMatrix');
x = t(1, :);
y = t(2, :);
将其作为您的示例,我们得到
h = @(x,y)(x-((1/0.0175)*(y/5500)*(1+(y/5500)^9)))
a = ezplot(h,[0,700,0,7000]);
t = get(a,'contourMatrix');
x = t(1, :);
y = t(2, :);
figure;
b = plot(x, y);
xlabel('x');
ylabel('y');
title('({x}-(({1}/{0.0175}) ({y}/{5500}) ({1}+({y}/{5500})^{9}))) = {0}');
生成的 ezplot
为
与plot
相同
关于matlab - 从 MATLAB 中的 ezplot 提取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33057321/