作者siriusmax (成大机械研究僧-拔辣松)
看板MATLAB
标题Re: [问题] 关於 matlab 的这个指令
时间Fri Apr 11 20:36:59 2008
※ 引述《jackycc (机奇)》之铭言:
: PQ=paddedsize(size(f));
: 关於这个指令 我在网页上 和书上都有看到
: 可是打再 matlab上却说没这指令
: 请问这指令到底可不可以用呢?
这个要自己加上去...
把下面这串存成paddedsize.m 吧
变成副程式来用
%-----%
function PQ = paddedsize(AB, CD, PARAM)
%PADDEDSIZE Computes padded sizes useful for FFT-based filtering.
% PQ = PADDEDSIZE(AB), where AB is a two-element size vector,
% computes the two-element size vector PQ = 2*AB.
%
% PQ = PADDEDSIZE(AB, 'PWR2') computes the vector PQ such that
% PQ(1) = PQ(2) = 2^nextpow2(2*m), where m is MAX(AB).
%
% PQ = PADDEDSIZE(AB, CD), where AB and CD are two-element size
% vectors, computes the two-element size vector PQ. The elements
% of PQ are the smallest even integers greater than or equal to
% AB + CD -1.
%
% PQ = PADDEDSIZE(AB, CD, 'PWR2') computes the vector PQ such that
% PQ(1) = PQ(2) = 2^nextpow2(2*m), where m is MAX([AB CD]).
if nargin == 1
PQ = 2*AB;
elseif nargin == 2 & ~ischar(CD)
PQ = AB + CD - 1;
PQ = 2 * ceil(PQ / 2);
elseif nargin == 2
m = max(AB); % Maximum dimension.
% Find power-of-2 at least twice m.
P = 2^nextpow2(2*m);
PQ = [P, P];
elseif nargin == 3
m = max([AB CD]); %Maximum dimension.
P = 2^nextpow2(2*m);
PQ = [P, P];
else
error('Wrong number of inputs.')
end
%---%
--
︿●﹁,
δ ⊕ 拔辣一颗外送唷
/╯
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.116.127.32
1F:推 repmat:虽然不是我的问题不过你好热心~给你推一下 04/11 21:34
2F:推 arthurs21:推 (也推一楼的ID) 04/11 21:48
3F:推 jackycc:恩 推!!! 04/11 22:10
4F:→ siriusmax:不敢居功...这是网路上找来的^^" 04/11 22:23
5F:推 Gwaewluin:要方便使用的话可以登录进toolbox里喔 04/11 23:12
6F:推 jackycc:嗯嗯 目前我得把全部贴到WORK 档案里 也可以使用了 04/11 23:30
7F:→ jackycc:不过登陆是要怎麽登录呢? 04/11 23:30
8F:推 james1022jk:这是影像处理的作业吗= =....这个副程式课本应该有 04/12 02:35