Converting LSF to Frequency Domain
조회 수: 2 (최근 30일)
이전 댓글 표시
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
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 Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!