无法在matlab中使用ezplot绘制圆
我想在图MATLAB中绘制6个圆。但是它不能出现 我认为这个代码是正确的,我试图给出轴的极限。但它不能解决我的问题无法在matlab中使用ezplot绘制圆,matlab,plot,matlab-figure,Matlab,Plot,Matlab Figure,我想在图MATLAB中绘制6个圆。但是它不能出现 我认为这个代码是正确的,我试图给出轴的极限。但它不能解决我的问题 clear all; clc; p=[8 9 3 4 7 4]; rtopi=[3 4 16 25 34 25]; n=length(p); for ii=1:n f=@(x,y)(x-p(ii)).^2+(y).^2-rtopi(ii)^2; gambar=ezplot(f); set(gambar,'color','k','linewidth',2);
clear all;
clc;
p=[8 9 3 4 7 4];
rtopi=[3 4 16 25 34 25];
n=length(p);
for ii=1:n
f=@(x,y)(x-p(ii)).^2+(y).^2-rtopi(ii)^2;
gambar=ezplot(f);
set(gambar,'color','k','linewidth',2);
grid on;
axis equal;
set(gca,'Color','y');
xlabel('Real');
ylabel('Imaginary');
title('Discs');
axis([-30 30 -30 30]);
end
结果是:
如何修复它?删除函数定义中的。*,只需使用x^2而不是x.^2 在循环结束前使用“保持” 将背景色、网格、标题等移到循环之外 最重要的是,为ezplot声明xmin,xmax。默认值为(-2pi到2pi)。
尝试:gambar=ezplot(f[xmin,xmax})并使用xmin和xmax的绘图限制删除函数定义中的。*只使用x^2而不是x.^2 在循环结束前使用“保持” 将背景色、网格、标题等移到循环之外 最重要的是,为ezplot声明xmin,xmax。默认值为(-2pi到2pi)。 Try:gambar=ezplot(f[xmin,xmax}),并使用xmin和xmax的绘图限制