how to use exp for this problem
1 次查看(过去 30 天)
显示 更早的评论
i=1;
Un=3;
sd=1.41;
w=exp(-[[i-Un]^2]/2[sd]^2)
0 个评论
回答(1 个)
James Tursa
2022-9-21
You need to use the * operator to multiply in the denominator. E.g.,
w=exp(-(i-Un)^2/(2*sd^2))
If i is not a variable defined by you, it will be interpreted as the imaginary number sqrt(-1).
1 个评论
Walter Roberson
2022-9-21
I would recommend
w = exp(-(i-Un).^2./(2*sd.^2));
as that would be able to work on non-scalars as well.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!