Function that fits a wave

6 vues (au cours des 30 derniers jours)
Rowan Humphreys
Rowan Humphreys le 17 Juin 2022
Modifié(e) : Pooja Kumari le 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)

Réponses (1)

Pooja Kumari
Pooja Kumari le 27 Sep 2023
Modifié(e) : Pooja Kumari le 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

Catégories

En savoir plus sur Simulation, Tuning, and Visualization dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by