Function that fits a wave

6 ビュー (過去 30 日間)
Rowan Humphreys
Rowan Humphreys 2022 年 6 月 17 日
編集済み: Pooja Kumari 2024 年 1 月 10 日
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)
  2 件のコメント
Rowan Humphreys
Rowan Humphreys 2022 年 6 月 24 日
Thanks, I will look into that :)

サインインしてコメントする。

回答 (1 件)

Pooja Kumari
Pooja Kumari 2023 年 9 月 27 日
編集済み: Pooja Kumari 2024 年 1 月 10 日
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

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by