資源簡介
用matlab編寫的計算1D,2D,3D的分形盒維數

代碼片段和文件信息
function?[nr]?=?boxcount(cvarargin)
%BOXCOUNT??Box-Counting?of?a?D-dimensional?array?(with?D=123).
%???[N?R]?=?BOXCOUNT(C)?where?C?is?a?D-dimensional?array?(with?D=123)
%???counts?the?number?N?of?D-dimensional?boxes?of?size?R?needed?to?cover
%???the?nonzero?elements?of?C.?The?box?sizes?are?powers?of?two?i.e.?
%???R?=?1?2?4?...?2^P?where?P?is?the?smallest?integer?such?that
%???MAX(SIZE(C))?<=?2^P.?If?the?sizes?of?C?over?each?dimension?are?smaller
%???than?2^P?C?is?padded?with?zeros?to?size?2^P?over?each?dimension?(e.g.
%???a?320-by-200?image?is?padded?to?512-by-512).?The?output?vectors?N?and?R
%???are?of?size?P+1.?For?a?RGB?color?image?(m-by-n-by-3?array)?a?summation
%???over?the?3?RGB?planes?is?done?first.
%
%???The?Box-counting?method?is?useful?to?determine?fractal?properties?of?a
%???1D?segment?a?2D?image?or?a?3D?array.?If?C?is?a?fractal?set?with
%???fractal?dimension?DF?%???Minkowski-Bouligand?dimension?or?Kolmogorov?capacity?or?Kolmogorov
%???dimension?or?simply?box-counting?dimension.
%
%???BOXCOUNT(C‘plot‘)?also?shows?the?log-log?plot?of?N?as?a?function?of?R
%???(if?no?output?argument?this?option?is?selected?by?default).
%
%???BOXCOUNT(C‘slope‘)?also?shows?the?semi-log?plot?of?the?local?slope
%???DF?=?-?dlnN/dlnR?as?a?function?of?R.?If?DF?is?contant?in?a?certain
%???range?of?R?then?DF?is?the?fractal?dimension?of?the?set?C.
%
%???The?execution?time?depends?on?the?sizes?of?C.?It?is?fastest?for?powers
%???of?two?over?each?dimension.
%
%???Examples:
%
%??????%?Plots?the?box-count?of?a?vector?containing?randomly-distributed
%??????%?0?and?1.?This?set?is?not?fractal:?one?has?N?=?R^-2?at?large?R
%??????%?and?N?=?cste?at?small?R.
%??????c?=?(rand(12048)<0.2);
%??????boxcount(c);
%
%??????%?Plots?the?box-count?and?the?fractal?dimension?of?a?2D?fractal?set
%??????%?of?size?512^2?(obtained?by?BOXDIV)?with?fractal?dimension
%??????%?DF?=?2?+?log(P)?/?log(2)?=?1.68?(with?P=0.8).
%??????c?=?randcantor(0.8?512?2);
%??????boxcount(c);
%??????figure?boxcount(c?‘slope‘);
%
%???F.?Moisy
%???Revision:?2.00??Date:?2006/11/22
%?History:
%?2006/11/22:?joins?into?a?single?file?boxcountn?(n=123).
%?control?input?argument
error(nargchk(12nargin));
%?check?for?true?color?image?(m-by-n-by-3?array)
if?ndims(c)==3
????if?size(c3)==3?&&?size(c1)>=8?&&?size(c1)>=8
????????c?=?sum(c3);
????end;
end;
warning?off
c?=?logical(squeeze(c));
warning?on
dim?=?ndims(c);?%?dim?is?2?for?a?vector?or?a?matrix?3?for?a?cube
if?dim>3
????error(‘Maximum?dimension?is?3.‘);
end
%?transpose?the?vector?to?a?1-by-n?vector
if?length(c)==numel(c)
????dim=1;
????if?size(c1)~=1???
????????c?=?c‘;
????end???
end
width?=?max(size(c));????%?largest?size?of?the?box
p?=?log(width)/log(2);???%?nbre?of?generations
%?remap?the?array?if?the?sizes?are?not?all?equal
%?or?if?they?are?not?power?of?two
%?(this?slows?down?the?computation!)
if?p~=round(p)?||?any(size(c)~=width)
????p?=?ceil(p);
????width?=?2^p
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????1651723??2009-03-18?20:50??計算1D2D3D的分形盒維數\71477227box-counting.rar
?????文件??????37254??2006-11-14?13:04??計算1D2D3D的分形盒維數\box-counting\Apollonian_gasket.gif
?????文件???????5587??2006-11-21?12:43??計算1D2D3D的分形盒維數\box-counting\boxcount.m
?????文件????????198??2006-11-21?12:40??計算1D2D3D的分形盒維數\box-counting\Contents.m
?????文件???????4998??2006-11-21?12:50??計算1D2D3D的分形盒維數\box-counting\demo.m
?????文件??????30608??2006-11-21?00:00??計算1D2D3D的分形盒維數\box-counting\dla.gif
?????文件????1125602??2006-11-20?17:03??計算1D2D3D的分形盒維數\box-counting\fractal_tree.jpg
?????文件??????15947??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo.html
?????文件???????1541??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo.png
?????文件??????17927??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_01.png
?????文件???????4913??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_02.png
?????文件???????5947??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_03.png
?????文件???????4489??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_04.png
?????文件???????8783??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_05.png
?????文件???????5058??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_06.png
?????文件???????4576??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_07.png
?????文件?????347480??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_08.png
?????文件??????19070??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_09.png
?????文件???????4738??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_10.png
?????文件??????15346??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_11.png
?????文件???????4383??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_12.png
?????文件???????5297??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_13.png
?????文件???????2329??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_14.png
?????文件???????4747??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_15.png
?????文件???????3714??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html\demo_16.png
????..A.SH.?????45056??2008-05-27?10:59??計算1D2D3D的分形盒維數\box-counting\html\Thumbs.db
?????文件???????5221??2006-11-21?12:42??計算1D2D3D的分形盒維數\box-counting\randcantor.m
????..AD...?????????0??2006-11-21?12:57??計算1D2D3D的分形盒維數\box-counting\html
?????目錄??????????0??2008-05-24?21:46??計算1D2D3D的分形盒維數\box-counting
?????目錄??????????0??2009-03-18?20:50??計算1D2D3D的分形盒維數
............此處省略3個文件信息
- 上一篇:利用MATLAB進行音頻特征提取
- 下一篇:matpower4.0正式版
評論
共有 條評論