Dear community,
My name is Rohith student at University of Freiberg, Germany. I came across in MATLA answers because I have problem to plot WAV files. I tried myself and looked in the documentation but I think I'm doing some mista. Here I attach two WAV files and Plots I got with code I use.ke:
WAV file:
Amplitude vs time
clear y Fs
info = audioinfo ( 'de ** av' )
[y, Fs] = audioread ( 'de *** v' );
t = 0: seconds (1 / Fs): seconds (info.Duration);
ylen = length (y); % signal length
t = (0: length (y) -1) / Fs;
plot (t * 1E + 3, y); % time vector
plot (t, y)
xlabel ( 'Time' )
ylabel ( 'amplitude' )
Frequency vs Magnitude (db)
clear, clc, close all
[x, fs] = audioread ( 'top081236.wav' ); % load an audio file
x = x (:, 1); % get the first channel
% determine the signal parameters
xlen = length (x); % signal length
t = (0: xlen-1) / fs; % time vector
% analysis parameters
wlen = 1024; % window length (recomended to be power of 2)
nfft = 2 * choose; % number of fft points (recomended to be power of 2)
hop = wlen / 2; % hop size
TimeRes = wlen / fs; % time result of the analysis (ie, window duration), s
FreqRes = 2 * fs / wlen; % frequency resolution of the analysis (using Hanning window), Hz
% time-frequency grid parameters
TimeResGrid = hop / fs; % time resolution of the grid, s
FreqResGrid = fs / nfft; % frequency resolution of the grid, Hz
% perform spectral analysis
w2 = hanning (xlen, 'periodic' );
[PS, fX] = periodogram (x, w2, nfft, fs, 'power' );
Xamp = 20 * log10 (sqrt (PS) * sqrt (2));
% plot the spectrum
plot (fX, Xamp)
grid on
xlim ([0 max (fX)])
set (gca, 'FontName' , 'Times New Roman' , 'FontSize' , 12)
xlabel ( 'Frequency, Hz' )
ylabel ( 'Magnitude, dB' )
title ( 'Amplitude spectrum of the signal' )
%% mark the dominant frequencies in the spectrogram
% [~, inds] = max (Samp, [], 1);
% fmax = fS (inds);
% hold on
% plot3 (tS, fmax, zeros (length (tS)), 'r')
And I'm looking for FFT and spectogram 3D.

답변 (1개)

Image Analyst
Image Analyst 2020년 6월 12일

0 개 추천

댓글 수: 1

Venkata Naga Rohith Tinnanuru
Venkata Naga Rohith Tinnanuru 2020년 6월 15일
ok sure, I'll check into it and thank you for your reply.

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

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by