

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
MATLAB solved quiz and assignment
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


function [summa,index]=max_sum(v,n) z=0; if n > length(v) summa=0; index= -1; return else for ii=1:(length(v)-n+1) jj=ii+(n-1); if jj <= length(v) w=sum(v(ii:jj)); z(ii)=w; end end end summa=max(z); b=find(summa==z); index=min(b); end