Hi, thanks for reading. I have a university lab and I'm stuck on using a surface plot to display some data.
I have to read an audio file and apply a windowing process to it. The code (up to the relevent part) is below:
x = enframe(rm,window);
b = 0;
for i = 1:size(x,1)
a = fftshift(fft(x(i,:)));
a = abs(a);
a = ifft(a);
a = real(a);
b = [b,a];
end
b(1) = [];
rm is from the audio file and window is from the hamming() function. The for loop just runs through each element and stores it in a new array (then I get rid of the first element, which is just 0).
My problem is that my instructions tell me to 'Plot the 3D magnitude-time-frequency spectrum using the surf() command'. What I get at the end of this is 'b', which is 1x15360, the original rm is 15360x1, x is 120x128 (just 'rm' broken into windows of 128 length). I also have a time variable, 't', of 1x15360. I can't see how I could make these work together for a surface plot? If I have two axes of 15360, would I not then need Z to be 15360x15360 to make a surface plot? I feel like I have all the information I need but I've got no clue how to present it.
Any help would be much appreciated.

댓글 수: 7

Mehmed Saad
Mehmed Saad 2020년 5월 18일
You have following solution
  1. Initialize b as empty and insert b = [b;a]
  2. Initialize b equal to size of x and index it i.e. b(i,:) = a
  3. if you donot want to follow above two steps, reshape b at the end of code with the dimension you instructor is telling you i.e. 128x120
Chris Deakin
Chris Deakin 2020년 5월 18일
Thanks for your help, but looking over it again I think I just don't understand what the question is asking me to do rather than not understanding the matlab function. I can plot things with your method above, but I'm sort of just plotting nonsense.
Mehmed Saad
Mehmed Saad 2020년 5월 18일
you have to follow any 1 of the above three methods, no all of three at a time
after than
surf(b)
Loren Patena
Loren Patena 2020년 5월 19일
hi, i'm also doing this lab, think we're in the same class, have you figured out about this one?
Chris Deakin
Chris Deakin 2020년 5월 19일
Hey, I couldn't figure this part out. I just put it in as surf(b) after I rearranged it, but I don't think it's right.
Mehmed Saad
Mehmed Saad 2020년 5월 19일
please attach the audio file
Loren Patena
Loren Patena 2020년 5월 21일
Hi, have you figured this one out?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

제품

릴리스

R2018b

질문:

2020년 5월 18일

댓글:

2020년 5월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by