Why doesnt the Fourier Transformation Work

2 次查看(过去 30 天)
Hello, I programmed a Fourier Transformator. Currently I generate a sine wave and Transform it. Later I want to use Sound. But I dont know how to write the Sound into a vector. But to my Question. If I run the code. I dont get a wave. I just get a Line. But what is the Problem? What is my Mistake?
wave = zeros(1,360)
samplingrate = 360
cyclestart = -100;
cyclesteps = 0.1;
cycleend = 100;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
adder = 0
for a = 1:length(wave)
wave(a) = 10*sin(a/36); %%<== only temporarily for generating a wave in the final version I want to read audio into a vector.
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
seconds = length(wave)/samplingrate;
b = 1;
plotx = cyclestart:cyclesteps:cycleend;
ploty = cyclestart:cyclesteps:cycleend;
for i = cyclestart:cyclesteps:cycleend
centerx = 0;
centery = 0;
averagepoint=0
for c = 1:length(wave)
centerx = wave(c)*cos(2*pi*i*seconds/length(wave)*c);
centery = wave(c)*sin(2*pi*i*seconds/length(wave)*c);
averagepoint = averagepoint + sqrt(centerx*centerx+centery*centery);
end
ploty(b)=averagepoint*length(wave)/samplingrate;
disp(datestr(now,'HH:MM:SS.FFFFFF'));
disp(i);
b = b + 1;
end
xlabel('Frequency');
plot(plotx,ploty);

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Oceanography and Hydrology 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by