octave - 八度音阶错误:词干:X 和 Y 的大小不一致
问题描述
我要计算一个离散时间傅里叶变换,我正在使用 fft() 和 fftshift()。但是,我遇到了一些错误,我不知道为什么。
这是我的编码。
t = 0:0.005:0.595;
n = t/0.005;
x = 4*cos(10*pi*t+0.25*pi) + 2*sin(20*pi*t) ;
xlim([0 0.595])
subplot(211) ; plot(t,x)
subplot(212) ; stem(n,x)
X = fft(x)/length(x);
f =-100:100:120;
P = angle(X).*(abs(X)>0.001);
subplot(211); stem(f,fftshift(abs(X)),'.')
subplot(212); stem(f,fftshift(P),'.')
这是我得到的错误。
>> LAB4
error: stem: inconsistent sizes for X and Y
error: called from
__stem__>check_stem_arg at line 278 column 11
__stem__ at line 37 column 49
stem at line 127 column 8
LAB4 at line 13 column 15
>>
解决方案
推荐阅读
- kubernetes - 用一些环境变量替换 configmap 内容
- amazon-web-services - 使用 aws 中私有 postgres db 中的堡垒主机访问网页中的数据
- python - 无法使用 BeautifulSoup 网页抓取在脚本标签内抓取
- vue.js - 在循环中使用 VuesJS 引导 4 个选项卡 - 无法返回到第一个选项卡
- javascript - 在 Vue.js 2.0 中将 css 类添加到 HTML 或 BODY 标签
- php - 错误消息:调用未定义的方法 CI_DB_mysqli_result::results()
- python - 在方法中的for循环中更改实例属性
- python - 如何使用python selenium单击iframe内的按钮
- css - 计算器屏幕上的大数字扩大了边界
- php - PHP:如何在保留另一个页面的数据的同时重定向到同一页面