הקו הירוק מתקבל ע"י שיערוך Least Squares / פולינום מסדר 1 - על הנקודותPoints = [1,3;2,6;4,18;3,14;4,17;5,23;6,29;6,30;1,2;4,16;1,3;6,31;6,31;7,40;1,2;2,6;8,50]; plot(Points( :,1),Points( :,2),'ob') hold on % plot([0;11.5], [0;60],'r') plot([1;60], [1;60],'g') p = polyfit(Points( :,1), Points( :,2),1); x1 = linspace(1, 11.1,100); f1 = polyval(p,x1); plot(x1,f1,'r--') ylim([0 60])
|