Hi,
I understand that you want to analyze a .wav audio file to extract the carrier frequency and the messenger (modulating) signal using MATLAB.
In order to analyze the .wav file to extract the carrier frequency and messenger signal, you can follow the below steps:
Read the .wav File:
Use the "audioread" function to load the audio data and sample rate from the .wav file.
% Read audio data and sample rate
[audioData, fs] = audioread('your_audio_file.wav');
Perform Fourier Transform:
Use the "fft" function to convert the audio signal into the frequency domain to identify the carrier frequency.
% Perform Fourier Transform
N = length(audioData);
Y = fft(audioData);
f = (0:N-1)*(fs/N); % Frequency vector
Identify Carrier Frequency:
Analyze the magnitude spectrum to find the peak frequency, which is likely the carrier frequency.
% Find the peak in the magnitude spectrum
[~, idx] = max(abs(Y));
carrierFreq = f(idx);
Extract Messenger Signal:
Use a band-pass filter around the carrier frequency to isolate the messenger signal.
% Design a band-pass filter
bpFilt = designfilt('bandpassiir', 'FilterOrder', 8, ...
'HalfPowerFrequency1', carrierFreq-100, ...
'HalfPowerFrequency2', carrierFreq+100, ...
'SampleRate', fs);
% Apply the filter
messengerSignal = filter(bpFilt, audioData);
Visualize the Results:
Plot the original audio data and the extracted messenger signal for comparison.
% Plot the original and messenger signals
t = (0:N-1)/fs; % Time vector
plot(t, audioData, t, messengerSignal);
legend('Original Signal', 'Messenger Signal');
xlabel('Time (s)');
ylabel('Amplitude');
Refer to the documentation of "audioread" function to know more about reading audio files: https://www.mathworks.com/help/matlab/ref/audioread.html
Refer to the documentation of "fft" function for performing Fourier Transform: https://www.mathworks.com/help/matlab/ref/fft.html
Refer to the documentation of "designfilt" function for designing digital filters: https://www.mathworks.com/help/signal/ref/designfilt.html
Hope this helps!