gradient descent method with Gerchberg–Saxton algorithm ?

6 ビュー (過去 30 日間)
Zulqarnain Sheikh
Zulqarnain Sheikh 2017 年 12 月 23 日
コメント済み: Zulqarnain Sheikh 2017 年 12 月 26 日
Hello everyone, may anyone help me in using gradient descent method with Gerchberg–Saxton algorithm ?
the code for GS Algorithm is :
clc
close all
clear all
model=zeros(150);
model(5:20, 20:121)=1;
model(24:140, 40:50)=1;
model(24:140, 85:97)=1;
figure(1);imagesc(model); colormap(gray)
DS=model;
model=2*pi.*rand(150)-pi;
pi_signal1=double(imread('pi.bmp'));
pi_signal=rgb2gray(pi_signal1);
pi_signal=imresize(pi_signal, [150 150]);
j=fftshift(fft2(pi_signal));
j=abs(j)/(max(max(abs(j))));
j=imadjust(abs(j), [0; 0.01], [0; 1]);
for k=1:1:150;
step1=fftshift(fft2(model));
phase=angle(step1);
Gu=medfilt2(j).*exp(i*phase);
gx=fft2(fftshift(Gu));
model=pi_signal.*exp(i*angle(gx));
figure(7),imagesc(abs(gx)); colormap(gray), title(num2str(k));
err(k)=-sqrt(sum(abs(gx(1:k,1))-pi_signal1(1:k,1))^2/k);
t(k) = 10*k; %simulation time, where dt is time for one increment of loop
end
figure(3)
plot(err,t);
Thanks
  2 件のコメント
Matt J
Matt J 2017 年 12 月 24 日
You haven't mentioned what difficulty you are having.
Zulqarnain Sheikh
Zulqarnain Sheikh 2017 年 12 月 26 日
Thanks for response, I just want to implement gradient descent in GS algorithm, but I am unable to write the code of 2D gradient descent and I am unable to find one online. Any help will be much appreciated

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by