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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by