Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

MATLAB - fft, find where it occurs in original data

Status
Not open for further replies.

masterj

Newbie level 1
Joined
Apr 1, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
Hey guys! :)
For the past few hours I've been trying to find solution to my problem, but unsuccesfully.
The situation is this: I have transformed audio data to fft, found a peak value and then I need to find where it occurs in original data.

My script:
LOAD THE FILE:
Code:
[AUDIO_ARRAY1 AUDIO_FS1] = wavread('AAA.WAV');

TRANSFORM IT TO FFT:
Code:
AMPLITUDE = abs(fft(AUDIO_ARRAY1));
AMPLITUDE = AMPLITUDE(1 : floor(NUMBER_OF_SAMPLES / 2)); % let's remove mirrored data
FREQUENCY = AUDIO_FS1 * (0 : floor(NUMBER_OF_SAMPLES / 2) - 1) / NUMBER_OF_SAMPLES;

FIND SOME VAL:
Code:
if max(AMPLITUDE) == 160
PEAK_VALUE = max(AMPLITUDE);
end

And now I need to find where in AUDIO_ARRAY1 my PEAK_VALUE occurs... Any ideas how to do this?
 
Last edited:

Some psuedo code
do
if current amplitude value < current+1 amplitude value then peak position = current+1 else peak position = current
current ++
while current < array size
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top