Filter löschen
Filter löschen

Function that fits a wave

7 Ansichten (letzte 30 Tage)
Rowan Humphreys
Rowan Humphreys am 17 Jun. 2022
Bearbeitet: Pooja Kumari am 10 Jan. 2024
I need to create a function that describes an audio wave. I have tried the fit() function with sine and gaussian but they don't have sufficient detail. Can you recomend me some technique that generates a function that more accurately describes this wave?
The following is my code:
clear all;
[y,Fs] = audioread('raindrop.wav');
sound(y,Fs);
x = (1:1:length(y))';
f = fit(x,y,'gauss8');
C = coeffvalues(f);
plot(f,x,y)
%the following shows me just the fit
F = C(01)*exp(-((x-C(02))/C(03)).^2) + C(04)*exp(-((x-C(05))/C(06)).^2) + ...
C(07)*exp(-((x-C(08))/C(09)).^2) + C(10)*exp(-((x-C(11))/C(12)).^2) + ...
C(13)*exp(-((x-C(14))/C(15)).^2) + C(16)*exp(-((x-C(17))/C(18)).^2) + ...
C(19)*exp(-((x-C(20))/C(21)).^2) + C(22)*exp(-((x-C(23))/C(24)).^2);
plot(x,F)
sound(F,Fs)

Antworten (1)

Pooja Kumari
Pooja Kumari am 27 Sep. 2023
Bearbeitet: Pooja Kumari am 10 Jan. 2024
Dear Rowan,
It is my understanding that you are facing issue with creating a function to describe an audio wave with more detail than a simple sine or Gaussian function. I am assuming that you want to learn more about how to describe an audio wave. You can consider any of the below approach for describing an audio wave:
You can also examine and comprehend the properties of the audio wave more thoroughly by making an app. You can refer to the below example on how to create an app to play and visualize audio file:
  • Using Fourier analysis of audio signal: Performing a Fourier analysis on an audio signal involves applying a Fourier transform, such as the Fast Fourier Transform (FFT), to move the audio wave from the time domain to the frequency domain. This will give the amplitude and phase information for each frequency component present in the audio wave. You can refer to the documentation below for more information: https://www.mathworks.com/help/matlab/ref/fft.html
Regards,
Pooja Kumari

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by