Labfans是一个针对大学生、工程师和科研工作者的技术社区。 论坛首页 | 联系我们(Contact Us)
MATLAB爱好者论坛-LabFans.com
返回   MATLAB爱好者论坛-LabFans.com > 工程数学软件 > MATLAB论坛
MATLAB论坛 一切MATLAB相关问题在此讨论。
 
 
主题工具 显示模式
旧 2008-12-13, 07:37   #1
cosomyr
初级会员
 
注册日期: 2008-12-13
年龄: 37
帖子: 1
声望力: 0
cosomyr 正向着好的方向发展
默认 FFT 的應用有錯, 可是不知道錯再哪裡, 請幫助我, 謝謝

下列的程序, 老師說有錯誤, 但是我實在找不出來

老師還要我解釋 畫出的兩個圖 到底代表什麼, 我也不是很清楚
我用了註解功能, 把我想的出來的, 都寫上去了 但是不一定對
有人可以幫我一下嘛? 謝謝 真的感激不盡
我已經花了5個小時在上面了 真的 都快哭出來了

1) 找出syntax 的錯誤
2) 解釋一下這兩個 subplot 到底在建立什麼樣的模型?
橫軸座標的單位可以提供一下嗎?


謝謝



function mysteryfunction
f0 = 261.625; %frequency of the wave
harm = 3.*f0; %the harmonic is in 3 times of the fequency
npts = 8192; %2^13; it's a power of 2
freq = linspace(-1e4,1e4,npts);
cspect = zeros(size(freq)); %generate a series of 0

%10 = bandwidth;
%compute the harmonic in both positive side and negative side
lv = (abs(freq - f0)<10)|(abs(freq+f0)<10);
lv2 = (abs(freq - harm)<10)|(abs(freq+harm)<10);

cspect(lv) = 1; %define the amplitude of a specific frequency shows on the plot
cspect(lv2) = 0.25; %define the amplitude of the harmonic shows on the plot

ctime = fftshift(fft(fftshift(cspect))); %fourier transform using FFT
tt = ((-npts./2)(npts./2)-1))./2e4; %frequency span = 2e4


figure
subplot(2,1,1)
plot(freq,cspect,'-r') %shows where the two harmonics located (v.s frequency)

subplot(2,1,2)
plot(tt,real(ctime),'-r') %plot the undulation
xlim([-.02 .02])
cosomyr 当前离线   回复时引用此帖
 


发帖规则
不可以发表新主题
不可以发表回复
不可以上传附件
不可以编辑自己的帖子

启用 BB 代码
论坛启用 表情符号
论坛启用 [IMG] 代码
论坛禁用 HTML 代码


相似的主题
主题 主题作者 版面 回复 最后发表
[求助]坐标和网格线的设定 drosophilia MATLAB论坛 2 2008-12-27 19:40
[分享]给新手的建议 guofeng0108 MATLAB论坛 0 2008-12-16 09:51
[求助]mathcad新手问题 ultrafrost MathCAD论坛 1 2008-12-11 09:56
[求助]符号方程求解 ericsun MATLAB论坛 9 2008-11-30 11:44
GM(1,1) lvlianggan MATLAB论坛 2 2008-11-07 22:52


所有时间均为北京时间。现在的时间是 15:36


Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.