Write Standard Deviation Distance
조회 수: 32 (최근 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!