![photo](/responsive_image/150/150/0/0/0/cache/matlabcentral/profiles/27884313_1665478467662_DEF.jpg)
Nyeche
Followers: 0 Following: 0
Feeds
已回答
Write a function max_sum that takes v a row vector of numbers & n,a positive integer as inputs.The function needs to find n consecutive elements of v whose sum is largest possible.It returns summa & index of first element of n consecutive integers.
function [summa, index] = max_sum (v, n) if n < 0 || n ~= fix(n) || ~isrow(v) error('Input must be an integer'); elseif n...
Write a function max_sum that takes v a row vector of numbers & n,a positive integer as inputs.The function needs to find n consecutive elements of v whose sum is largest possible.It returns summa & index of first element of n consecutive integers.
function [summa, index] = max_sum (v, n) if n < 0 || n ~= fix(n) || ~isrow(v) error('Input must be an integer'); elseif n...
2 years 前 | 0