Could MATLAB convert a data( time series, e.g. SP&500 index 1-minute data) to a '.wav' format file?
1 次查看(过去 30 天)
显示 更早的评论
Hi, there. I learnt that MATLAB wavread() function can read in the '.wav' file, then the function fft() can do the Fast Fourier Transform for this series of data, and the return the frequency of the data. For example:
% define a function like this to return the FFT results more conveniently
function [f,output]=sfft(s,Fs)
T=1/Fs;
L=length(s);
% t=(0:L-1)*T;
Nfft=2^nextpow2(L);
Y=fft(s,Nfft)/L;
f=Fs/2*linspace(0,1,Nfft/2+1);
output=2*abs(Y(1:Nfft/2+1));
% In the script, do this:
% FFT
t = 0:0.001:1;
freq = 1000;
y_original = exp(-0.2 * t) .*sin(2*pi * 100*t);
n = length(t);
noise = randn(1, n) * 3;
y_new = y_original + noise;
[f, outs] = sfft(y_new, freq);
figure;
subplot(2,1,1);
plot(freq*t(1:200), y_new(1:200));
subplot(2,1,2);
plot(f, outs);
So this will be the result:
But I was wondering could MATLAB do the reverse thing, like transform a series of data( maybe financial data) into a '.wav' format file, so that I can listen to it? Possibly it will be just as white noise, but could this be done? And also could this FFT method be done to analyze the stock price data to find the frequencies? I'm not familiar with FFT, just a finance student. Thanks a lot.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Financial Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!