fittune.m 317 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10
 function res=fittune(x,bpm,mach,or)
 qd6=findcells(mach,'FamName','QD6');
 qf7=findcells(mach,'FamName','QF7');
 cini=[x(1:4)';0;0]
  mach=setcellstruct(mach,'PolynomB',qd6,[x(5)],1,2);
  mach=setcellstruct(mach,'PolynomB',qf7,[x(6)],1,2);
  orb=linepass(mach,cini,bpm);
  orb=orb(1:2,:)';
 
  res=sum(std2(orb-or));