我想画一个橙色的圆
t=linspace(0,2pi,100);
x=sin(t);y=cos(t);
plot(x,y,'red')
axis([-2,2,-2,2])
axis equal
hold on
grid on
plot(2x,2*y,'o')
我尝试把o改成orange 但是无法运行
可根据RGB颜色表中橙色对应的颜色三原色代码或十六进制代码表示线条颜色属性:
clc,clear
t=linspace(0,2*pi,100);
x=sin(t);y=cos(t);
plot(x,y,'-','Color','#D95319','Linewidth',1.5)
axis([-2,2,-2,2])
axis equal
hold on
grid on
plot(2*x,2*y,'o','MarkerFaceColor','#FF6100')
如以下两种橙色:
如帮助您解决疑惑,请点击采纳(不是点赞),谢谢合作!
1、启动MATLAB,新建脚本,输入以下代码:
close all; clear all; clc
r=2; theta=0:pi/100:2*pi;
x=rcos(theta); y=rsin(theta);
rho=r*sin(theta);
figure(1)
plot(x,y,'-')
hold on; axis equal
fill(x,y,'c')
figure(2)
h=polar(theta,rho);
set(h,'LineWidth',2)
2、保存和运行上述脚本,在figure(1)中得到plot(x,y)和fill(x,y)绘制的圆。
3、使用plot(x,y)画圆只需要接着输入以下代码:
figure(3)
subplot(1,2,1);plot(x,y,'-');hold on; axis square
fill(x,y,'c')
subplot(1,2,2);h=polar(theta,rho);set(h,'LineWidth',2)
4、点击保存并运行。