Could MATLAB convert a data( time series, e.g. SP&500 index 1-minute data) to a '.wav' format file?

4 views (last 30 days)
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.

Answers (0)

Categories

Find more on Financial Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!