For some reason, when I define L=ts^2 the analytical and numerical solutions seem to agree (L = no. sampling points, ts = time sample).推荐答案从分析解决方案开始,让我们重新说明一下.您对函数f(t) = exp(-a*t^2)进行了采样,并且以解析方式构建了以Ts=ts/L=1e-3的采样率收集L=1000*ts=1e7样本的分析答案.这意味着您的采样频率为Fs=1/Ts=1e3.Starting from the analytical solution, let's rephrase things a bit. You have a sampling of the function f(t) = exp(-a*t^2), and the way you've constructed the analytical answer you're collecting L=1000*ts=1e7 samples at a sampling rate of Ts=ts/L=1e-3. This means that your sampling frequency is Fs=1/Ts=1e3.由于要与使用fft/ifft获得的结果进行比较,因此应考虑使用数字或 em 频率,这意味着您为自己定义的值变换将对应于数字频率Since you want to compare against results obtained with fft/ifft, you should be considering digital or discrete frequencies, meaning the values you define for your transform will correspond to the digital frequenciesfrd = (-L/2:L/2-1)/L;将其映射到角频率,我们有:Mapping this to angular frequencies, we have:w = 2*pi*frd;但是,当您尝试计算值时,还需要记住,这些频率应代表您期望的连续时间谱的样本.因此,您可以根据采样频率缩放这些值:But when you're trying to compute the values, you also need to keep in mind that these frequencies should represent samples of the continuous time spectrum you're expecting. So you scale these values by your sampling frequency:Y = sqrt(pi/a)*exp(-(Fs*w).^2/(4*a));y = Fs*ifftshift(ifft(fftshift(Y)));当您比较分析性答案和计算性答案时,它们现已匹配.When you compare the analytical and computed answers, they now match.鉴于此,对这个问题的简短回答是,最后您错误地缩放了y.您正在按ts(即1e4)进行缩放,但是您需要按Fs=1e3的采样频率对其进行缩放.这就是为什么您最终损失10倍的原因.The short answer to your question, given this, is that you are scaling y incorrectly at the end. You're scaling it by ts, which is 1e4, but you need to be scaling it by the sampling frequency which is Fs=1e3. That's why you end up off by a factor of 10. 这篇关于Matlab中IFFT的缩放问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 04:13
查看更多