⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cp6_2.m

📁 离散控制系统设计的MATLAB 代码
💻 M
字号:
%%%%%%%%%%% Comprehensive Problem 6.2 %%%%%%%%%%%
%   Discrete-Time Control Problems using        %
%       MATLAB and the Control System Toolbox   %
%   by J.H. Chow, D.K. Frederick, & N.W. Chbat  %
%         Brooks/Cole Publishing Company        %
%                September 2002                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%   ---- 2D deblurring ----

while(0)
load clown
figure, colormap(map), image(X)

% make an image by shifting 10 pixels left and up
[nrow,ncol] = size(X);
Y = zeros(nrow,ncol);
n=10;
Y(1:nrow-n,1:ncol-n)=X(n+1:nrow,n+1:ncol);
Z=X+0.3*Y;  % create a double image of clown
figure, colormap(map), image(Z)
save clownb Z map
end

load clown X map
figure, colormap(map), image(X)
title('Original image')
disp('Original clown image')
disp('******>'), pause

load clownb Z map
figure, colormap(map), image(Z)
title('Blurred image')
disp('Blurred clown image')
disp('******>'), pause

[nrow,ncol] = size(Z); n = 10;

% one-term FIR correction
U = zeros(nrow,ncol);
U(1:nrow-n,1:ncol-n)=Z(n+1:nrow,n+1:ncol);
W = Z - 0.3*U;
figure, colormap(map), image(W)
title('One-term correction')
disp('Deblurring blurred clown image using one correction term')
disp('******>'), pause

% two-term FIR correction
U = zeros(nrow,ncol);
U(1:nrow-2*n,1:ncol-2*n)=Z(2*n+1:nrow,2*n+1:ncol);
W = W + 0.09*U;
figure, colormap(map), image(W)
title('Two-term correction')
disp('Deblurring blurred clown image using two correction terms')
disp('******>'), pause

% three-term FIR correction
U = zeros(nrow,ncol);
U(1:nrow-3*n,1:ncol-3*n)=Z(3*n+1:nrow,3*n+1:ncol);
W = W - 0.027*U;
figure, colormap(map), image(W)
title('Three-term correction')
disp('Deblurring blurred clown image using three correction terms')
%%%%%%%%%%

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -