Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
|
![]() |
#1 |
初级会员
注册日期: 2008-12-13
年龄: 37
帖子: 1
声望力: 0 ![]() |
![]()
下列的程序, 老師說有錯誤, 但是我實在找不出來
老師還要我解釋 畫出的兩個圖 到底代表什麼, 我也不是很清楚 我用了註解功能, 把我想的出來的, 都寫上去了 但是不一定對 有人可以幫我一下嘛? 謝謝 真的感激不盡 我已經花了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) ![]() 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]) |
![]() |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]坐标和网格线的设定 | 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 |