Partial Differentiation of a function with exponential is different from other calculators

조회 수: 2 (최근 30일)
function being tested:
exp[-0.5((h-c)/s)^2]
first differentiation with respect to 'h' in matlab code as follows:
syms x c h s
fn1 = exp(-0.5 * (((h-c)/s)^2));
diff(fn1,h)
ans = 
I got the answer = (exp(-(c - h)^2/(2*s^2))*(2*c - 2*h))/(2*s^2)
but in other calculators I got the answer =
Is there any thing wrong with my code?

채택된 답변

Dyuman Joshi
Dyuman Joshi 2022년 7월 3일
There's nothing wrong with your answer, it's just simplified version of it. 2 from numerator and denominator is cancelled out and 1/2 is converted to 0.5 in the exponential.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by