Image of ideal particle
2 次查看(过去 30 天)
显示 更早的评论
Hello matlab community.
I am working on a project, the first part of the project that ı need to understand basic idea of the code below. Can anybody explain ?
----------------------------------------
function h=simage(img,numcolor,axistype,minimg,maximg);
imscale=0; if ~exist('axistype')
axistype=['image'];
end
if ~exist('minimg') & ~exist('maximg')
imscale=1;
else
if (~exist('maximg'))
maximg=max(img(:));
end
if (~exist('minimg'))
minimg=min(img(:));
end
if (maximg==0 & minimg==0)
minimg=min(img(:));
maximg=max(img(:));
end
end
if ~exist('numcolor') numcolor=64; end
if imscale==0 h=imagesc(img,[minimg maximg]); else h=imagesc(img); end
axis(axistype);
end
------------------------------------------
if you run the code shown below with the first one together , you will see the some figure like a particle. ---------------------------------------
function ipi=ipf(cr,D,w)
ipi=(1-tanh((abs(cr)-D/2)/w))/2;
------------------------------------
For example I do not understand the meaning of exist in the first code. What is it used for ?
I do not have a much time, I look at some matlab books but I can not find anything about the situation. Please help..
Thank you..
0 个评论
回答(1 个)
dpb
2013-8-11
编辑:dpb
2013-8-11
...For example I do not understand the meaning of exist in the first code. What is it used for ?
I do not have a much time, I look at some matlab books but I can not find anything about the situation.
Well, it would undoubtedly take far less of your valuable time (and be much less annoying(*) here as well) if you were to simply type
doc exist
at the command line first.
(*) Or, if you're going to ask at least don't whine while doing so...
7 个评论
dpb
2013-8-11
编辑:dpb
2013-8-11
Searching for numcolor in what you posted shows it isn't used.
The only references to it are in the argument list and the location where it is defined if non-existent. But, there's no reference to it after that point so it's superfluous. For the answer to why you'll have to ask whoever supplied the function to begin with.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!