how to use exp for this problem

1 次查看(过去 30 天)
Ashutosh
Ashutosh 2022-9-21
i=1;
Un=3;
sd=1.41;
w=exp(-[[i-Un]^2]/2[sd]^2)

回答(1 个)

James Tursa
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
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 CenterFile Exchange 中查找有关 Exponents and Logarithms 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by