>> x=[1 1.3 1.5 1.9 2 3 3.5 4.1 5 6]
x =
Columns 1 through 9
1.0000 1.3000 1.5000 1.9000 2.0000 3.0000 3.5000 4.1000 5.0000
Column 10
6.0000
>> y=[4.4 6.4 7.4 7.8 7.4 -20.8 -62.2 -151.6 -406 -940.6]
y =
Columns 1 through 9
4.4000 6.4000 7.4000 7.8000 7.4000 -20.8000 -62.2000 -151.6000 -406.0000
Column 10
-940.6000
>> plot(x,y)
>> plot(x,y,':o')
>> A=linspace(1,6)
A =
Columns 1 through 9
1.0000 1.0505 1.1010 1.1515 1.2020 1.2525 1.3030 1.3535 1.4040
Columns 10 through 18
1.4545 1.5051 1.5556 1.6061 1.6566 1.7071 1.7576 1.8081 1.8586
Columns 19 through 27
1.9091 1.9596 2.0101 2.0606 2.1111 2.1616 2.2121 2.2626 2.3131
Columns 28 through 36
2.3636 2.4141 2.4646 2.5152 2.5657 2.6162 2.6667 2.7172 2.7677
Columns 37 through 45
2.8182 2.8687 2.9192 2.9697 3.0202 3.0707 3.1212 3.1717 3.2222
Columns 46 through 54
3.2727 3.3232 3.3737 3.4242 3.4747 3.5253 3.5758 3.6263 3.6768
Columns 55 through 63
3.7273 3.7778 3.8283 3.8788 3.9293 3.9798 4.0303 4.0808 4.1313
Columns 64 through 72
4.1818 4.2323 4.2828 4.3333 4.3838 4.4343 4.4848 4.5354 4.5859
Columns 73 through 81
4.6364 4.6869 4.7374 4.7879 4.8384 4.8889 4.9394 4.9899 5.0404
Columns 82 through 90
5.0909 5.1414 5.1919 5.2424 5.2929 5.3434 5.3939 5.4444 5.4949
Columns 91 through 99
5.5455 5.5960 5.6465 5.6970 5.7475 5.7980 5.8485 5.8990 5.9495
Column 100
6.0000
>> p=polyfit(x,y,2)
p =
-65.2291 286.3546 -265.7766
>> B=polyval(p,A)
B =
Columns 1 through 9
-44.6512 -36.9440 -29.5696 -22.5280 -15.8191 -9.4430 -3.3997 2.3109 7.6887
Columns 10 through 18
12.7337 17.4459 21.8254 25.8722 29.5861 32.9673 36.0157 38.7314 41.1143
Columns 19 through 27
43.1644 44.8817 46.2663 47.3181 48.0372 48.4234 48.4769 48.1977 47.5857
Columns 28 through 36
46.6409 45.3633 43.7530 41.8099 39.5340 36.9254 33.9840 30.7098 27.1029
Columns 37 through 45
23.1632 18.8907 14.2855 9.3475 4.0767 -1.5268 -7.4631 -13.7322 -20.3341
Columns 46 through 54
-27.2687 -34.5360 -42.1362 -50.0691 -58.3348 -66.9332 -75.8645 -85.1284 -94.7252
Columns 55 through 63
-104.6547 -114.9170 -125.5121 -136.4399 -147.7005 -159.2938 -171.2200 -183.4788 -196.0705
Columns 64 through 72
-208.9949 -222.2521 -235.8421 -249.7648 -264.0203 -278.6086 -293.5296 -308.7834 -324.3700
Columns 73 through 81
-340.2893 -356.5415 -373.1263 -390.0440 -407.2944 -424.8776 -442.7935 -461.0422 -479.6237
Columns 82 through 90
-498.5379 -517.7850 -537.3647 -557.2773 -577.5226 -598.1007 -619.0115 -640.2552 -661.8316
Columns 91 through 99
-683.7407 -705.9826 -728.5573 -751.4648 -774.7050 -798.2780 -822.1838 -846.4223 -870.9936
Column 100
-895.8977
>> plot(x,y,':ok',A,B,':r')
>> grid on
>> plot(x,y,':ok',A,B,':r','LineWidth',2)
>> xlabel('Nilai x')
>> ylabel('Nilai y')
>> title('Grafik Pencocokan Kurva Kuadrat Terkecil')
>> grid
>> gtext('{\leftarrow} Pencocokan Kurva Kuadrat Terkecil')
x =
Columns 1 through 9
1.0000 1.3000 1.5000 1.9000 2.0000 3.0000 3.5000 4.1000 5.0000
Column 10
6.0000
>> y=[4.4 6.4 7.4 7.8 7.4 -20.8 -62.2 -151.6 -406 -940.6]
y =
Columns 1 through 9
4.4000 6.4000 7.4000 7.8000 7.4000 -20.8000 -62.2000 -151.6000 -406.0000
Column 10
-940.6000
>> plot(x,y)
>> plot(x,y,':o')
>> A=linspace(1,6)
A =
Columns 1 through 9
1.0000 1.0505 1.1010 1.1515 1.2020 1.2525 1.3030 1.3535 1.4040
Columns 10 through 18
1.4545 1.5051 1.5556 1.6061 1.6566 1.7071 1.7576 1.8081 1.8586
Columns 19 through 27
1.9091 1.9596 2.0101 2.0606 2.1111 2.1616 2.2121 2.2626 2.3131
Columns 28 through 36
2.3636 2.4141 2.4646 2.5152 2.5657 2.6162 2.6667 2.7172 2.7677
Columns 37 through 45
2.8182 2.8687 2.9192 2.9697 3.0202 3.0707 3.1212 3.1717 3.2222
Columns 46 through 54
3.2727 3.3232 3.3737 3.4242 3.4747 3.5253 3.5758 3.6263 3.6768
Columns 55 through 63
3.7273 3.7778 3.8283 3.8788 3.9293 3.9798 4.0303 4.0808 4.1313
Columns 64 through 72
4.1818 4.2323 4.2828 4.3333 4.3838 4.4343 4.4848 4.5354 4.5859
Columns 73 through 81
4.6364 4.6869 4.7374 4.7879 4.8384 4.8889 4.9394 4.9899 5.0404
Columns 82 through 90
5.0909 5.1414 5.1919 5.2424 5.2929 5.3434 5.3939 5.4444 5.4949
Columns 91 through 99
5.5455 5.5960 5.6465 5.6970 5.7475 5.7980 5.8485 5.8990 5.9495
Column 100
6.0000
>> p=polyfit(x,y,2)
p =
-65.2291 286.3546 -265.7766
>> B=polyval(p,A)
B =
Columns 1 through 9
-44.6512 -36.9440 -29.5696 -22.5280 -15.8191 -9.4430 -3.3997 2.3109 7.6887
Columns 10 through 18
12.7337 17.4459 21.8254 25.8722 29.5861 32.9673 36.0157 38.7314 41.1143
Columns 19 through 27
43.1644 44.8817 46.2663 47.3181 48.0372 48.4234 48.4769 48.1977 47.5857
Columns 28 through 36
46.6409 45.3633 43.7530 41.8099 39.5340 36.9254 33.9840 30.7098 27.1029
Columns 37 through 45
23.1632 18.8907 14.2855 9.3475 4.0767 -1.5268 -7.4631 -13.7322 -20.3341
Columns 46 through 54
-27.2687 -34.5360 -42.1362 -50.0691 -58.3348 -66.9332 -75.8645 -85.1284 -94.7252
Columns 55 through 63
-104.6547 -114.9170 -125.5121 -136.4399 -147.7005 -159.2938 -171.2200 -183.4788 -196.0705
Columns 64 through 72
-208.9949 -222.2521 -235.8421 -249.7648 -264.0203 -278.6086 -293.5296 -308.7834 -324.3700
Columns 73 through 81
-340.2893 -356.5415 -373.1263 -390.0440 -407.2944 -424.8776 -442.7935 -461.0422 -479.6237
Columns 82 through 90
-498.5379 -517.7850 -537.3647 -557.2773 -577.5226 -598.1007 -619.0115 -640.2552 -661.8316
Columns 91 through 99
-683.7407 -705.9826 -728.5573 -751.4648 -774.7050 -798.2780 -822.1838 -846.4223 -870.9936
Column 100
-895.8977
>> plot(x,y,':ok',A,B,':r')
>> grid on
>> plot(x,y,':ok',A,B,':r','LineWidth',2)
>> xlabel('Nilai x')
>> ylabel('Nilai y')
>> title('Grafik Pencocokan Kurva Kuadrat Terkecil')
>> grid
>> gtext('{\leftarrow} Pencocokan Kurva Kuadrat Terkecil')









0 komentar:
Posting Komentar