Advertisement
Guest User

Untitled

a guest
May 25th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 8.88 KB | None | 0 0
  1. close all
  2. clear all
  3. myx(1,:) = [ 0,0.838,0.986,0.989,0.915,0.796,0.65,0.491,0.326,0.16,0 ];
  4. myx(2,:) = [ 0,1.397,1.777,1.947,1.999,1.975,1.896,1.778,1.631,1.463,1.281 ];
  5. myx(3,:) = [ 0.974,0.999,0.962,0.886,0.783,0.664,0.535,0.401,0.265,0.131,0 ];
  6. myx(4,:) = [ 0.974,1.0047,1.0354,1.0661,1.0968,1.1275,1.1582,1.1889,1.2196,1.2503,1.281 ];
  7. myx(5,:) = [ 0,2.095,2.466,2.472,2.287,1.989,1.626,1.227,0.814,0.401,0 ];
  8. myx(6,:) = [ 0,2.514,2.959,2.966,2.744,2.387,1.951,1.473,0.977,0.481,0 ];
  9. myx(7,:) = [ 0.841,0.77,0.692,0.61,0.525,0.437,0.349,0.26,0.172,0.085,0 ];
  10. myx(8,:) = [ 0.841,0.884,0.927,0.97,1.012,1.053,1.094,1.134,1.174,1.212,1.25 ];
  11. myx(9,:) = [ 2.319,2.224,2.12,2.011,1.898,1.784,1.671,1.56,1.453,1.349,1.25 ];
  12. myx(10,:) = [ 2.319,2.332,2.344,2.357,2.369,2.382,2.394,2.406,2.419,2.431,2.444 ];
  13. myx(11,:) = [ 0,2.829,3.585,3.912,4,3.931,3.753,3.495,3.181,2.827,2.444 ];
  14. myx(12,:) = [ 3.111,3.294,3.478,3.66,3.839,4.015,4.185,4.35,4.509,4.66,4.805 ];
  15. myx(13,:) = [ 2.991,3.19,3.391,3.591,3.788,3.981,4.169,4.35,4.523,4.688,4.844 ];
  16. myx(14,:) = [ 2.622,2.859,3.108,3.361,3.614,3.862,4.102,4.333,4.551,4.756,4.946 ];
  17. myx(15,:) = [ 1.882,1.974,2.068,2.163,2.26,2.358,2.458,2.558,2.659,2.76,2.861 ];
  18. myx(16,:) = [ 3,3.052,3.185,3.37,3.591,3.833,4.088,4.348,4.608,4.864,5.111 ];
  19. myx(17,:) = [ 3.385,3.294,3.221,3.162,3.114,3.076,3.047,3.025,3.011,3.003,3 ];
  20. myx(18,:) = [ 2.861,2.9134,2.9658,3.0182,3.0706,3.123,3.1754,3.2278,3.2802,3.3326,3.385 ];
  21. myx(19,:) = [ 3.473,3.514,3.5549,3.5959,3.6368,3.6778,3.7187,3.7597,3.8006,3.8416,3.8825 ];
  22. myx(20,:) = [ 3.8825,3.9235,3.9644,4.0054,4.0463,4.0873,4.1282,4.1692,4.2101,4.2511,4.292 ];
  23. myx(21,:) = [ 4.292,4.3739,4.4558,4.5377,4.6196,4.7015,4.7834,4.8653,4.9472,5.0291,5.111 ];
  24. myx(22,:) = [ 0,-0.838,-0.986,-0.989,-0.915,-0.796,-0.65,-0.491,-0.326,-0.16,-0 ];
  25. myx(23,:) = [ 0,-1.397,-1.777,-1.947,-1.999,-1.975,-1.896,-1.778,-1.631,-1.463,-1.281 ];
  26. myx(24,:) = [ -0.974,-0.999,-0.962,-0.886,-0.783,-0.664,-0.535,-0.401,-0.265,-0.131,-0 ];
  27. myx(25,:) = [ -0.974,-1.0047,-1.0354,-1.0661,-1.0968,-1.1275,-1.1582,-1.1889,-1.2196,-1.2503,-1.281 ];
  28. myx(26,:) = [ 0,-2.095,-2.466,-2.472,-2.287,-1.989,-1.626,-1.227,-0.814,-0.401,-0 ];
  29. myx(27,:) = [ 0,-2.514,-2.959,-2.966,-2.744,-2.387,-1.951,-1.473,-0.977,-0.481,-0 ];
  30. myx(28,:) = [ -0.841,-0.77,-0.692,-0.61,-0.525,-0.437,-0.349,-0.26,-0.172,-0.085,-0 ];
  31. myx(29,:) = [ -0.841,-0.884,-0.927,-0.97,-1.012,-1.053,-1.094,-1.134,-1.174,-1.212,-1.25 ];
  32. myx(30,:) = [ -2.319,-2.224,-2.12,-2.011,-1.898,-1.784,-1.671,-1.56,-1.453,-1.349,-1.25 ];
  33. myx(31,:) = [ -2.319,-2.332,-2.344,-2.357,-2.369,-2.382,-2.394,-2.406,-2.419,-2.431,-2.444 ];
  34. myx(32,:) = [ 0,-2.829,-3.585,-3.912,-4,-3.931,-3.753,-3.495,-3.181,-2.827,-2.444 ];
  35. myx(33,:) = [ -3.111,-3.294,-3.478,-3.66,-3.839,-4.015,-4.185,-4.35,-4.509,-4.66,-4.805 ];
  36. myx(34,:) = [ -2.991,-3.19,-3.391,-3.591,-3.788,-3.981,-4.169,-4.35,-4.523,-4.688,-4.844 ];
  37. myx(35,:) = [ -2.622,-2.859,-3.108,-3.361,-3.614,-3.862,-4.102,-4.333,-4.551,-4.756,-4.946 ];
  38. myx(36,:) = [ -1.882,-1.974,-2.068,-2.163,-2.26,-2.358,-2.458,-2.558,-2.659,-2.76,-2.861 ];
  39. myx(37,:) = [ -3,-3.052,-3.185,-3.37,-3.591,-3.833,-4.088,-4.348,-4.608,-4.864,-5.111 ];
  40. myx(38,:) = [ -3.385,-3.294,-3.221,-3.162,-3.114,-3.076,-3.047,-3.025,-3.011,-3.003,-3 ];
  41. myx(39,:) = [ -2.861,-2.9134,-2.9658,-3.0182,-3.0706,-3.123,-3.1754,-3.2278,-3.2802,-3.3326,-3.385 ];
  42. myx(40,:) = [ -3.473,-3.514,-3.5549,-3.5959,-3.6368,-3.6778,-3.7187,-3.7597,-3.8006,-3.8416,-3.8825 ];
  43. myx(41,:) = [ -3.8825,-3.9235,-3.9644,-4.0054,-4.0463,-4.0873,-4.1282,-4.1692,-4.2101,-4.2511,-4.292 ];
  44. myx(42,:) = [ -4.292,-4.3739,-4.4558,-4.5377,-4.6196,-4.7015,-4.7834,-4.8653,-4.9472,-5.0291,-5.111 ];
  45.  
  46. myy(1,:) = [ 0,0.329,0.658,0.987,1.316,1.645,1.974,2.303,2.632,2.961,3.29 ];
  47. myy(2,:) = [ 0,0.2394,0.4788,0.7182,0.9576,1.197,1.4364,1.6758,1.9152,2.1546,2.394 ];
  48. myy(3,:) = [ 1.932,2.2011,2.4702,2.7393,3.0084,3.2775,3.5466,3.8157,4.0848,4.3539,4.623 ];
  49. myy(4,:) = [ 1.932,1.973,2.015,2.058,2.102,2.148,2.194,2.242,2.292,2.342,2.394 ];
  50. myy(5,:) = [ 0,0.4935,0.987,1.4805,1.974,2.4675,2.961,3.4545,3.948,4.4415,4.935 ];
  51. myy(6,:) = [ 0,0.5806,1.1612,1.7418,2.3224,2.903,3.4836,4.0642,4.6448,5.2254,5.806 ];
  52. myy(7,:) = [ 7.297,7.5608,7.8246,8.0884,8.3522,8.616,8.8798,9.1436,9.4074,9.6712,9.935 ];
  53. myy(8,:) = [ 7.297,7.3847,7.4724,7.5601,7.6478,7.7355,7.8232,7.9109,7.9986,8.0863,8.174 ];
  54. myy(9,:) = [ 5.92,6.1454,6.3708,6.5962,6.8216,7.047,7.2724,7.4978,7.7232,7.9486,8.174 ];
  55. myy(10,:) = [ 5.92,5.9452,5.9704,5.9956,6.0208,6.046,6.0712,6.0964,6.1216,6.1468,6.172 ];
  56. myy(11,:) = [ 0,0.6172,1.2344,1.8516,2.4688,3.086,3.7032,4.3204,4.9376,5.5548,6.172 ];
  57. myy(12,:) = [ 5.063,5.2448,5.4266,5.6084,5.7902,5.972,6.1538,6.3356,6.5174,6.6992,6.881 ];
  58. myy(13,:) = [ 5.276,5.4749,5.6738,5.8727,6.0716,6.2705,6.4694,6.6683,6.8672,7.0661,7.265 ];
  59. myy(14,:) = [ 5.89,6.1413,6.3926,6.6439,6.8952,7.1465,7.3978,7.6491,7.9004,8.1517,8.403 ];
  60. myy(15,:) = [ 6.853,6.9202,6.9874,7.0546,7.1218,7.189,7.2562,7.3234,7.3906,7.4578,7.525 ];
  61. myy(16,:) = [ 7.822,8.0805,8.339,8.5975,8.856,9.1145,9.373,9.6315,9.89,10.1485,10.407 ];
  62. myy(17,:) = [ 7.295,7.3477,7.4004,7.4513,7.5058,7.5585,7.6112,7.6639,7.7166,7.7693,7.822 ];
  63. myy(18,:) = [ 7.524,7.495,7.467,7.441,7.416,7.392,7.37,7.349,7.33,7.311,7.295 ];
  64. myy(19,:) = [ 1.106,1.136,1.171,1.212,1.258,1.311,1.371,1.438,1.513,1.596,1.687 ];
  65. myy(20,:) = [ 1.687,1.788,1.897,2.016,2.145,2.285,2.436,2.598,2.772,2.958,3.157 ];
  66. myy(21,:) = [ 3.157,3.593,4.085,4.636,5.248,5.926,6.672,7.49,8.383,9.354,10.407 ];
  67. myy(22,:) = [ 0,0.329,0.658,0.987,1.316,1.645,1.974,2.303,2.632,2.961,3.29 ];
  68. myy(23,:) = [ 0,0.2394,0.4788,0.7182,0.9576,1.197,1.4364,1.6758,1.9152,2.1546,2.394 ];
  69. myy(24,:) = [ 1.932,2.2011,2.4702,2.7393,3.0084,3.2775,3.5466,3.8157,4.0848,4.3539,4.623 ];
  70. myy(25,:) = [ 1.932,1.973,2.015,2.058,2.102,2.148,2.194,2.242,2.292,2.342,2.394 ];
  71. myy(26,:) = [ 0,0.4935,0.987,1.4805,1.974,2.4675,2.961,3.4545,3.948,4.4415,4.935 ];
  72. myy(27,:) = [ 0,0.5806,1.1612,1.7418,2.3224,2.903,3.4836,4.0642,4.6448,5.2254,5.806 ];
  73. myy(28,:) = [ 7.297,7.5608,7.8246,8.0884,8.3522,8.616,8.8798,9.1436,9.4074,9.6712,9.935 ];
  74. myy(29,:) = [ 7.297,7.3847,7.4724,7.5601,7.6478,7.7355,7.8232,7.9109,7.9986,8.0863,8.174 ];
  75. myy(30,:) = [ 5.92,6.1454,6.3708,6.5962,6.8216,7.047,7.2724,7.4978,7.7232,7.9486,8.174 ];
  76. myy(31,:) = [ 5.92,5.9452,5.9704,5.9956,6.0208,6.046,6.0712,6.0964,6.1216,6.1468,6.172 ];
  77. myy(32,:) = [ 0,0.6172,1.2344,1.8516,2.4688,3.086,3.7032,4.3204,4.9376,5.5548,6.172 ];
  78. myy(33,:) = [ 5.063,5.2448,5.4266,5.6084,5.7902,5.972,6.1538,6.3356,6.5174,6.6992,6.881 ];
  79. myy(34,:) = [ 5.276,5.4749,5.6738,5.8727,6.0716,6.2705,6.4694,6.6683,6.8672,7.0661,7.265 ];
  80. myy(35,:) = [ 5.89,6.1413,6.3926,6.6439,6.8952,7.1465,7.3978,7.6491,7.9004,8.1517,8.403 ];
  81. myy(36,:) = [ 6.853,6.9202,6.9874,7.0546,7.1218,7.189,7.2562,7.3234,7.3906,7.4578,7.525 ];
  82. myy(37,:) = [ 7.822,8.0805,8.339,8.5975,8.856,9.1145,9.373,9.6315,9.89,10.1485,10.407 ];
  83. myy(38,:) = [ 7.295,7.3477,7.4004,7.4513,7.5058,7.5585,7.6112,7.6639,7.7166,7.7693,7.822 ];
  84. myy(39,:) = [ 7.524,7.495,7.467,7.441,7.416,7.392,7.37,7.349,7.33,7.311,7.295 ];
  85. myy(40,:) = [ 1.106,1.136,1.171,1.212,1.258,1.311,1.371,1.438,1.513,1.596,1.687 ];
  86. myy(41,:) = [ 1.687,1.788,1.897,2.016,2.145,2.285,2.436,2.598,2.772,2.958,3.157 ];
  87. myy(42,:) = [ 3.157,3.593,4.085,4.636,5.248,5.926,6.672,7.49,8.383,9.354,10.407 ];
  88.  
  89. for k = 1:42
  90. x0 = myy(k,:);
  91. y = myx(k,:);
  92. [x0;y]';
  93. n = length(x0);
  94. b = zeros(n,n);
  95. for i = 1:n
  96. b(i,1)=y(i);
  97. end
  98. %b
  99. for j = 2:n
  100. for i = 1:n-j+1
  101. b(i,j) = (b(i+1,j-1)-b(i,j-1))/(x0(i+j-1)-x0(i));
  102. end
  103. end
  104. %b
  105. len = 1;
  106. for x = x0(1):(x0(n)-x0(1))/500:x0(n)
  107. t = 1;
  108. y = b(1,1);
  109. for j = 2:n
  110. t = t*(x-x0(j-1));
  111. y = y+b(1,j)*t;
  112. end
  113. c(len,1) = x;
  114. c(len,2) = y;
  115. len = len+1;
  116. end
  117. ansx(k,:) = c(:,2);
  118. ansy(k,:) = c(:,1);
  119. end
  120.  
  121. plot(ansx(1,:),ansy(1,:),
  122.      ansx(2,:),ansy(2,:),
  123.      ansx(3,:),ansy(3,:),
  124.      ansx(4,:),ansy(4,:),
  125.      ansx(5,:),ansy(5,:),
  126.      ansx(6,:),ansy(6,:),
  127.      ansx(7,:),ansy(7,:),
  128.      ansx(8,:),ansy(8,:),
  129.      ansx(9,:),ansy(9,:),
  130.      ansx(10,:),ansy(10,:),
  131.      ansx(11,:),ansy(11,:),
  132.      ansx(12,:),ansy(12,:),
  133.      ansx(13,:),ansy(13,:),
  134.      ansx(14,:),ansy(14,:),
  135.      ansx(15,:),ansy(15,:),
  136.      ansx(16,:),ansy(16,:),
  137.      ansx(17,:),ansy(17,:),
  138.      ansx(18,:),ansy(18,:),
  139.      ansx(19,:),ansy(19,:),
  140.      ansx(20,:),ansy(20,:),
  141.      ansx(21,:),ansy(21,:),
  142.      ansx(22,:),ansy(22,:),
  143.      ansx(23,:),ansy(23,:),
  144.      ansx(24,:),ansy(24,:),
  145.      ansx(25,:),ansy(25,:),
  146.      ansx(26,:),ansy(26,:),
  147.      ansx(27,:),ansy(27,:),
  148.      ansx(28,:),ansy(28,:),
  149.      ansx(29,:),ansy(29,:),
  150.      ansx(30,:),ansy(30,:),
  151.      ansx(31,:),ansy(31,:),
  152.      ansx(32,:),ansy(32,:),
  153.      ansx(33,:),ansy(33,:),
  154.      ansx(34,:),ansy(34,:),
  155.      ansx(35,:),ansy(35,:),
  156.      ansx(36,:),ansy(36,:),
  157.      ansx(37,:),ansy(37,:),
  158.      ansx(38,:),ansy(38,:),
  159.      ansx(39,:),ansy(39,:),
  160.      ansx(40,:),ansy(40,:),
  161.      ansx(41,:),ansy(41,:),
  162.      ansx(42,:),ansy(42,:)
  163.      )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement