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에서 Exponents and Logarithms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!