Clear Filters
Clear Filters

HOW CAN I WRITE THE INVERSE FUNCTION OF PERIODIC PLUS SMOOTH DECOMPOSITION. I HAVE TAKEN A 360*360 MATRIX AND DIVIDED IT INTO 90 BLOCKS THEN PERFORMED DECOMPOSITION ON EACH

3 views (last 30 days)
function [p1,s] = perdm_fun(b)
[ny,nx] = size(b);
b = double(b);
X = 1:nx; Y = 1:ny;
v = zeros(ny,nx);
v(1,X) = b(1,X)-b(ny,X);
v(ny,X) = -v(1,X);
v(Y,1 ) = v(Y,1 )+b(Y,1)-b(Y,nx);
v(Y,nx) = v(Y,nx)-b(Y,1)+b(Y,nx);
fx = repmat(cos(2.*pi*(X -1)/nx),ny,1);
fy = repmat(cos(2.*pi*(Y'-1)/ny),1,nx);
fx(1,1)=0.; % avoid division by 0 in the line below
s = real(ifft2(fft2(v)*0.5./(2.-fx-fy)));
p = b-s;
%pmod = reshape(p.',1,[]);
%list=knuthShuffle(pmod);
%p1=reshape(list,4,4);
I want to perform inverse decomposition and get blocks as output...As i am a new comer in this field i can't find any way. hope to get help. I am getting b from this code:
mat=4*ones(1,90);
newRow = zeros(1,size(F3,2));
newF3 = [F3(1:359, :); newRow; F3(360:end, :)];
H=mat2cell(newF3,mat,mat);
%for i=1:90
%M=cellfun(@str2double, H);
%end
for i=1:90
for j=1:90
celmat=zeros(4);
b=(H{i,j});
% bmod = reshape(b.',1,[]);
% list=knuthShuffle(bmod);
% b1=reshape(list,4,4);
[p,s] = perdm_fun(b); end
end

Answers (0)

Categories

Find more on Denoising and Compression in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!