Normalized Sinc using matrix inputs
2 次查看(过去 30 天)
显示 更早的评论
My code is to use the formula sinc(x) = sin(x*pi)/(x*pi) to return a matrix of the same size as the input, and when dealing with a element equal to zero, it is to return a value of one.
function y = normsinc(vec)
y = sin(vec)*pi ./ (vec*pi);
This is what I have right now, but it can't use if statement to check the values of the input. I get the same size output as the input but for zeros I get NaN.
2 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 NaNs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!