>> r=1; >> clear res; >> syms x; >> res=[]; >> for i=30:size(a,1)-3; >> if (a(i,2)>1.5*max(a([i-3,i+3],2))&&a(i,2)>max(a([i-1,i+1],2))) >> p=polyfit(a(i-2:i+2,1),a(i-2:i+2,2),4); >> temp=[]; >> if (polyval(p,a(i+2,1))/a(i+2,2)>1.05 || polyval(p,a(i+2,1))/a(i+2,2)<0.95) >> p=polyfit(a(i-2:i+1,1),a(i-2:i+1,2),3); >> temp=roots([3*p(1) 2*p(2) p(3)]); >> else >> temp=roots([4*p(1) 3*p(2) 2*p(3) p(4)]); >> end >> for j=1:size(temp,1) >> if (temp(j)>a(i-1,1) && temp(j)> res(r)=temp(j); >> r=r+1; >> end >> end >> end >> end