求助!MATLAB出错 Error using polar (line 70) THETA and RHO must be the same size.

>> theta=0:1./6*pi;11./6*pi;
>> m=[0.97 0.91 0.82 0.74 0.66 0.59 0.54 0.49 0.45 0.41 0.22 0.15 0.11];
>> polar(theta,m);
Error using polar (line 70)
THETA and RHO must be the same size.
想问一下哪里出错并且为什么
谢谢大佬们了!

产生此类错误的原因,就是theta向量长度(数据个数)与m向量长度(数据个数)不相等。为了避免错误可以用linspace()函数生成线性间距向量。修改后的代码

>> m=[0.97 0.91 0.82 0.74 0.66 0.59 0.54 0.49 0.45 0.41 0.22 0.15 0.11];

>> theta=linspace(0,1/6*pi,13);  %13是m向量长度(数据个数)

>> polar(theta,m);

运行可以得到如下图像。

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-08-22
提示了数组大小不同。M大小是13. 检查一下 THETA的大小。