%Manoj Karkee
%BSYSE 530: Lect 9
%derive FFT and inverse FFT
clear all;
close all;
x = 1:100;
for(i=1:100);
X(i,:) = x;
end;
Y = X';
y = x';
%2D Sinosoidal function
z = 100*cos(2*pi*(32*X/512+24*Y./512))+100;
surf(x,y,z);
%2-D FFT using 1-D FFT
z_fft = fftshift(fft(fft(z,size(x,2),2),size(y,1),1));%This is the equivalent statement to
%use a 'for loop' for fft in each rows and
%then for fft in each column
%Calculating and displaying phase and magnitudes of FFT results
z_log10 = log10(1+abs(z_fft));
z_phase = angle(z_fft);
z_fft_direct = fftshift(fft2(z, size(y,1), size(x,2)));
z_direct_log10 = log10(1+abs(z_fft_direct));
z_direct_phase = angle(z_fft_direct);
colormap(gray);
subplot(2,2,1), imagesc(z_log10); title('Log10 Magnitude of composite 1D FFTs');
subplot(2,2,2), imagesc(z_phase); title('Phase of composite 1D FFTs');
subplot(2,2,3), imagesc(z_direct_log10); title('Log10 Magnitude of Direct 2D FFT');
subplot(2,2,4), imagesc(abs(z_direct_phase)), title('Phase of Direct 2D FFT');
%Inversing the images
z_inv=abs(ifft(ifft(z_fft, [], 2), [], 1));
%lena_fft has been origin shifted, but it does not affect the ifft
%operation as the spectrum is cyclic.???????
z_inv_direct = abs(ifft2(z_fft_direct));
% 'symmetric' option causes IFFT to treat 'lena_fft_direct' as conjugate symmetric
% in two dimensions so that the output is purely real. This option is
% useful when 'lena_fft_direct' is not exactly conjugate symmetric merely because of
% round-off error.
%Displaying the final results
figure;
colormap(gray);
subplot(1,3,1), imagesc(z); title('Original Image');
subplot(1,3,2), imagesc(z_inv); title('Inversed Image: Composite 1D FFTs');
subplot(1,3,3), imagesc(z_inv_direct); title('Inversed Image: Direct 2D FFT');
fft.zip_fft逆变换matlab_二维fft
版权申诉
69 浏览量
2022-09-24
06:59:35
上传
评论 1
收藏 956B ZIP 举报
寒泊
- 粉丝: 75
- 资源: 1万+
最新资源
- MATLAB大数据仿真案例-蚁群算法(ACO)用于求解旅行商(TSP)问题.rar
- MySQL基础知识-个人笔记.rar
- Project8.ipynb
- Python实现BWO-LSTM白鲸算法优化长短期记忆神经网络时间序列预测(完整源码和数据)
- C语言实现文件读写操作的几种常用方法-C 语言.rar
- RK 3568 Android11 版本的梯形校正补丁
- 基于pyqt yolov5 dlib的驾驶员行为监控系统源码+模型.zip
- python代码案例详解-旅行商问题的多种求解算法.rar
- 单相电力电子负载仿真,PWM整流+单相并网逆变
- C语言功能模块(配置文件读取 、debug日志记录等).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0