Add basic code

This commit is contained in:
Ksyer
2024-07-16 15:55:00 +08:00
parent e98983b374
commit 1c009370a5
6 changed files with 121 additions and 19 deletions
+20
View File
@@ -0,0 +1,20 @@
function y = sft_thd(x, thd)
if isequal(size(x), size(thd))
tmp = abs(x);
y = x;
y(tmp <= thd) = 0;
y(tmp > thd) = (tmp(tmp > thd) - thd(tmp > thd)) .* x(tmp > thd) ./ tmp(tmp > thd);
else
tmp = abs(x);
y = x;
y(tmp <= thd) = 0;
y(tmp > thd) = (tmp(tmp > thd) - thd) .* x(tmp > thd) ./ tmp(tmp > thd);
end
end