Converting LSF to Frequency Domain

2 ビュー (過去 30 日間)
Nour Aburaed
Nour Aburaed 2018 年 12 月 17 日
コメント済み: Jatin 2024 年 10 月 14 日
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 件のコメント
Jatin
Jatin 2024 年 10 月 14 日
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:

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by