# Why doesnt the Fourier Transformation Work

1 ビュー (過去 30 日間)
dieter alfred 2020 年 7 月 16 日

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;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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);

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by