求matlab高手~Error using plot Vectors must be the same lengths问

问题描述:

求matlab高手~Error using plot Vectors must be the same lengths问题
代码如下:
w=0:0.05:20;f0=[500 1000 2000 4000 8000];for m=1:5;for n=1:400;y(m,n)=pinx(f0(m),w(n));endendsubplot(2,3,1),plot(w,20*log10(abs(y(1,:)))),xlabel('f0=0.5kHz');
为啥说“Error using plotVectors must be the same lengths”
然后怎么改正啊?
1个回答 分类:综合 2014-10-28

问题解答:

我来补答
你的w是1×401维的,而y(1,:)是1×400维,所以出错了.
建议修改w,比如w=0.05:0.05:20;或者w=0:0.05:19.95;具体需要你仔细看一下了.
你好,你的问题我已经回答,如有疑问请追问,若满意请采纳哦O(∩_∩)O~
 
 
展开全文阅读
剩余:2000