I was given the following problem at my university: We are given an audio file which we have to download. Following that we have to create a MATLAB code that can create a discrete-time graph of the signal in the time domain. Following that we have to create another graph this time displaying its Fourier transform.

The problem is that we have zero knowledge of MATLAB. I tried piecing some things together but the truth is that I am completely lost. This is the best I could come up with. It displays an error on the readaudio line

[data, Fs] = audioread("/MATLAB Drive/recordingX.wav");
X = getaudiodata(data);
n = 0:1/Fs:(length(X)-1)/Fs;

So basically I can't figure out how to read the .wav file and display it in the time domain and as a result I cannot move on to the next step. I have uploaded the file to MATLAB online.

Can you please offer some assistance? Mind you I have no idea how MATLAB works so what I am looking for is not a detailed explanation but rather something that I could use.

Thanks in advance, and sorry for any problems with the question it's my first time using a site like that

  • $\begingroup$ Welcome to DSP.SE! Could you please share the error msg? $\endgroup$ Commented May 24, 2023 at 17:37
  • $\begingroup$ Thanks! It's .errorDocCallback $\endgroup$ Commented May 24, 2023 at 17:41
  • $\begingroup$ I don’t think you need the getaudiodata line? $\endgroup$
    – Jdip
    Commented May 24, 2023 at 21:07

1 Answer 1


getaudiodata() doesn't do anything useful here, and it can't be called this way since its a method from a specific class. The following should work

[data, Fs] = audioread("/MATLAB Drive/recordingX.wav");
% n = 0:1/Fs:(length(X)-1)/Fs;
n = 0:1/Fs:(length(data)-1)/Fs;

Mind you I have no idea how MATLAB works

Then this is probably not to the right tool for you. There are other languages or tools that can do the same thing. If you are not at all familiar with this type of work, I would take some sort of class first, otherwise you will just stumble from one problem to the next.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.