Giter Club home page Giter Club logo

beginning_asa's People

Contributors

mmorise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

beginning_asa's Issues

離散フーリエ変換について

初めまして
私は今、matlabで離散フーリエ変換をfft関数などを使わずにプログラムを書いています。「dft_size×dft_size の行列」と「dft_size×1 の行列」の積により DFT 計算を行うプログラムを書きたいのですが上手く書けなくて困っています。

下記プログラムの
X_real=zeros(dft_size,1);
X_imag=zeros(dft_size,1);のX_real=zeros()内を(dft_size,dft_size)に変えて、
scriptファイルの
A=zeros(dft_size,1);
T=zeros(dft_size,1);のA()内を(dft_size,dft_size)に書き換えればよいと思ったのですが、上手くいきませんでした。

アドバイスを頂けたら幸いです。

以下、プログラムリスト
//////

DFT.m

function [X_real,X_imag]=DFT(x_real,x_imag,dft_size)
X_real=zeros(dft_size,1);
X_imag=zeros(dft_size,1);
for k=1:dft_size,
for n=1:dft_size,
w_real=cos(-2pi(k-1)(n-1)/dft_size);
w_imag=sin(-2
pi*(k-1)(n-1)/dft_size);
X_real(k,1)=X_real(k,1)+w_real
x_real(n,1)-w_imagx_imag(n,1);
X_imag(k,1)=X_imag(k,1)+w_real
x_imag(n,1)+w_imag*x_real(n,1);
end
end
////////

script.m

clear;
dft_size=60;
x_real=audioread('test.wav',[1 dft_size]);
x_imag=zeros(dft_size,1);
[X_real,X_imag]=DFT(x_real,x_imag,dft_size);
A=zeros(dft_size,1);
T=zeros(dft_size,1);
frequency=zeros(dft_size,1);
for k=1:dft_size,
A(k,1)=sqrt(X_real(k,1)*X_real(k,1)+X_imag(k,1)*X_imag(k,1));
T(k,1)=atan(X_imag(k,1)/X_real(k,1));
frequency(k,1)=k-1;
end
subplot(2,1,1);
stem(frequency,A);
subplot(2,1,2);
stem(frequency,T);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.