如何绘画复平面上的无理数1的根号2次方
在线等,求大佬指教。采纳有偿
你好同学,这个很好画的
function main
a = 1^(sqrt(2));
x = real(a);
y = imag(a);
plot(x,y,'go','markersize',10,'markerfacecolor','g','markeredgecolor','b');
PlotLineArrow(gca, [0,x],[0, y], 'b','b')
end
function PlotLineArrow(obj, x, y, markerColor, lineColor)
% 获取 Axes 位置
posAxes = get(obj, 'Position');
posX = posAxes(1);
posY = posAxes(2);
width = posAxes(3);
height = posAxes(4);
% 获取 Axes 范围
limX = get(obj, 'Xlim');
limY = get(obj, 'Ylim');
minX = limX(1);
maxX = limX(2);
minY = limY(1);
maxY = limY(2);
% 转换坐标
xNew = posX + (x - minX) / (maxX - minX) * width;
yNew = posY + (y - minY) / (maxY - minY) * height;
% 画箭头
annotation('arrow', xNew, yNew, 'color', lineColor);
end