Write Standard Deviation Distance
28 ビュー (過去 30 日間)
古いコメントを表示
I am asked to write a function called standard_deviation_distance that takes as input a data vector [1xN] v and a number x [1x1], in that order. And I have code to call your function:
v = [10 12 14];
x = 7;
dist = standard_deviation_distance(v,x)% =-2.5
0 件のコメント
回答 (2 件)
VBBV
2022 年 6 月 5 日
編集済み: VBBV
2022 年 11 月 10 日
v = [10 12 14];
x = ones(1,numel(v))*7;% length of x vector (weights) for each element and to be same as vector v
dist = standard_deviation_distance(v,x);
disp(['The standard deviation distance is ', num2str(dist)])
function y = standard_deviation_distance(v,x)
y = std(v,x);
end
0 件のコメント
Himanshu Desai
2023 年 5 月 31 日
編集済み: Himanshu Desai
2023 年 5 月 31 日
function y = standard_deviation_distance(v,x)
m = mean(v);
s = std(v);
y = (x-m)/s;
end
dist = -2.500
v = [10 12 14];
x = 7;
y = standard_deviation_distance(v,x)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Genomics and Next Generation Sequencing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!