Using bsxfun to plot
2 ビュー (過去 30 日間)
古いコメントを表示
%% I have this following code:
n=10000;
g = exp(-linspace(-2,2,round(n/30)).^2);
[origsig, signal] = deal(conv(randn(n,1),g,'same'));
propnoise = 0.02;
noisepnts = randperm(n);
noisepnts = noisepnts(1:round(n*propnoise));
for ti = 1:length(noisepnts)
tidx = noisepnts(ti):noisepnts(ti)+ceil(rand*10);
signal(tidx) = NaN;
end
%%
islands = bwconncomp (~isfinite(signal));
islands.N = cellfun(@length,islands.PixelIdxList);
filtsig = signal;
for ii = 1:islands.NumObjects
bndpoints = [islands.PixelIdxList{ii}(1)-1 islands.PixelIdxList{ii}(end)+1];
if bndpoints(1)<1 || bndpoints(2)>n
continue
end
linterp = linspace(0,1,islands.N(ii)+2)*diff(signal(bndpoints)) + signal(bndpoints(1));
filtsig(bndpoints(1):bndpoints(2)) = linterp;
end
3 件のコメント
Walter Roberson
2021 年 11 月 20 日
I do not see a question? You showed your code but I do not see where you ask for information or advice?
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!