Write Standard Deviation Distance

39 views (last 30 days)
Lisbeth Ccoyo Ortiz
Lisbeth Ccoyo Ortiz on 4 Jun 2022
Edited: VBBV on 5 Jun 2022
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

Answers (1)

VBBV
VBBV on 5 Jun 2022
Edited: VBBV on 5 Jun 2022
v = [10 12 14];
x = [7 7 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)])
The standard deviation distance is 1.633
function y = standard_deviation_distance(v,x)
y = std(v,x);
end

Community Treasure Hunt

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

Start Hunting!