Filter löschen
Filter löschen

how to use exp for this problem

2 Ansichten (letzte 30 Tage)
Ashutosh
Ashutosh am 21 Sep. 2022
Kommentiert: Walter Roberson am 21 Sep. 2022
i=1;
Un=3;
sd=1.41;
w=exp(-[[i-Un]^2]/2[sd]^2)

Antworten (1)

James Tursa
James Tursa am 21 Sep. 2022
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 Kommentar
Walter Roberson
Walter Roberson am 21 Sep. 2022
I would recommend
w = exp(-(i-Un).^2./(2*sd.^2));
as that would be able to work on non-scalars as well.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Exponents and Logarithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by