I want to code and plot for time-frequency analysis using Fourier transform. I do not know how can I code them and plotting.
3 次查看(过去 30 天)
显示 更早的评论
I have given A-scan (amplitudes) data for six stages for the ultrasonic signals. So, I have normalised the amplitudes data for six stages. Then plotted time vs normalised amplitude. Now, I do not understand how can code for frequency response using FFT and plot frequency(KHz) vs magnitude. I am going to wring my normalised code underneath.
clear; close all; clc;
data_file = "Q2.xlsx"
u = readmatrix(data_file);
fs = 2.25e6; %in hz
N = size(u,1);
t = (0:(N-1))*fs;
normalised_amplitude = zeroes(size(u));
figure
for i = 1:size(U,2)
ui = u(:,i);
ui = ui/max(abs(ui)); %normalisation of signal
normalised_amplitude(:,i) = ui;
subplot(3,2,1)
plot(t,ui)
xlabel('time(mu-sec)')
ylabel('Normalised amplitude')
end
0 个评论
回答(1 个)
Nithin Kumar
2023-8-30
编辑:Nithin Kumar
2023-8-30
Hi Rumana,
I understand that you have normalized the A-scan amplitudes data for six stages and want to know the Implementation of frequency response using FFT and plot frequency vs magnitude graph.
To calculate the frequency response using FFT, kindly refer to the following steps:
1. Calculate FFT: Use “fft” function to calculate the Fast Fourier Transform of your normalized A-scan data for each of the six stages.
N = length(normalized_data); % Length of the data
fft_result = fft(normalized_data);
2. Frequency Axis: Create a frequency axis using the sampling rate and the length of your data.
fs = sampling_rate; % Replace with your actual sampling rate
f = fs*(0:(N/2))/N;
3. Magnitude Calculation: Calculate the magnitude of the FFT result.
magnitude = abs(fft_result(1:N/2+1));
4. Plotting: Plot the frequency vs magnitude:
plot(f, magnitude);
xlabel('Frequency (KHz)');
ylabel('Magnitude');
title('Frequency Response using FFT');
Combine the above steps with your normalized A-scan data for each stage and set the desired sampling rate value.
To know more information regarding the frequency analysis using FFT, kindly refer to the following documentation.
I hope this answer helps you.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!