多个函数的 Scilab polarplot 不会为每个图形使用不同的颜色

Scilab polarplot of multiple functions does not use different colors for every graph

我想在同一张图中绘制两个不同的极函数,但颜色不同。

这是我的代码:

clear
close
clc
clf
theta=[0:((1*%pi)/180):((359*%pi)/180)];
a=2;
b=3;
rho=a+b*sin(theta);
rro=a-b*sin(theta);
polarplot([theta theta], [real(rho) real(rro)],[27 14]);
xtitle("Caracol con lazo interior");
legends(['r = a+bsen(θ)';'r = a-bsen(θ)'],[27 14],opt=3);

虽然图表绘制正确,但它只为两者使用第一个定义的颜色。在这种情况下:27

所以,我想要一个橙色,另一个绿色。

你能告诉我如何解决这个问题吗?提前致谢。

在您的代码中 theta 是行向量,因此 rhorro 也是行向量。因此,当您将它们组合为 [theta theta], [real(rho) real(rro)] 时,结果是 一条曲线 通过连接两条曲线获得。当然,它是用一种颜色绘制的。解决方法是使 theta 成为列向量:

theta=[0:((1*%pi)/180):((359*%pi)/180)]';

[theta theta][real(rho) real(rro)]是两列的矩阵,结果符合预期;两条曲线的两种颜色。