Converting LSF to Frequency Domain
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a Line Spread Function (LSF), which is plotted against pixel positions in (um). This is a sample of that data:
position = [-1.780405 -1.186936 -0.593468 0 0.593468 1.186936 1.780405 2.373873]; %x-axis position(um)
LSF = [48.172258 48.866131 46.863226 49.217079 46.385073 40.899024 39.912261 37.784698 ]; %y-axis signal LSF
plot(x,y)
xlabel('Pixel Position (um)')
ylabel('LSF')
I have 251 positions and 251 LSF, but here I am showing 8 elements of each only.
I want to convert LSF signal to frequency domain and plot it against frequency (ω) instead of pixel position. Can someone help me out with this? Any hints are appreciated.
1 Kommentar
Jatin
am 14 Okt. 2024
As per my understanding you want to plot the converted LSF to frequency and plot it against frequency, to convert your Line Spread Function (LSF) signal from the spatial domain to the frequency domain, you can use the Fast Fourier Transform (FFT) using the 'fft' function in MATLAB, Here is an example code how you can perform this:
% Sample data
position = [-1.780405, -1.186936, -0.593468, 0, 0.593468, 1.186936, 1.780405, 2.373873];
LSF = [48.172258, 48.866131, 46.863226, 49.217079, 46.385073, 40.899024, 39.912261, 37.784698];
% Full data would be used in actual implementation
% position = ... (your full 251-element position array)
% LSF = ... (your full 251-element LSF array)
% Perform FFT
LSF_fft = fft(LSF);
% Compute frequency axis
N = length(LSF); % Number of samples
d = mean(diff(position)); % Average spacing in micrometers
Fs = 1/d; % Sampling frequency (in inverse micrometers)
freq = linspace(0, Fs/2, floor(N/2)+1); % Frequency axis (only positive frequencies)
% Plot magnitude of FFT
figure;
plot(freq, abs(LSF_fft(1:floor(N/2)+1)));
xlabel('Frequency (\omega) [1/\mum]');
ylabel('Magnitude');
title('Frequency Domain Representation of LSF');
You can know more about the 'fft' function using the link below:
Antworten (0)
Siehe auch
Kategorien
Mehr zu Shifting and Sorting Matrices finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!