Cant get my code to work

조회 수: 1 (최근 30일)
Jack Ellis
Jack Ellis 2019년 10월 28일
댓글: Jack Ellis 2019년 10월 28일
Hi, ive written the following function
function Guass_t=Gaussian_t(x)
n = length(x);
mean = sum(x)/n;
std = sqrt(sum((x-mean).^2/n));
A=sqrt(2*pi*((std).^2));
B=1/A;
C=(x-mean).^2;
D=2*std*std;
Gauss_t= B*exp(-C/D)
end
It doesnt seem to work. It keeps saying Guass_t is undefined. Please can someone explain where I have gone wrong.

채택된 답변

Stephen23
Stephen23 2019년 10월 28일
편집: Stephen23 2019년 10월 28일
Note the spelling difference:
Guass_t % function output arugment
Gauss_t % variable defined in the function
  댓글 수: 1
Jack Ellis
Jack Ellis 2019년 10월 28일
Hi, thankyou so much

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by