先貼我的程式碼
r = [9.37 12.32 12.46 9.51 5.92 4.33 4.29 3.88 4.51 10.92 27.50 49.67 69.59
81.73 88.19 86.05];
w = linspace(400,700,16);
plot(w,r,'bo');
for i=3:13
a0 = r(i);
a1 = (2*r(i-2)-16*r(i-1)+16*r(i+1)-2*r(i+2))/24;
a2 = (-r(i-2)+16*r(i-1)-30*r(i)+16*r(i+1)-r(i+2))/24;
a3 = (-9*r(i-2)+39*r(i-1)-70*r(i)+66*r(i+1)-33*r(i+2)+7*r(i+3))/24;
a4 = (13*r(i-2)+64*r(i-1)+126*r(i)-124*r(i+1)+61*r(i+2)-12*r(i+3))/24;
a5 = (-5*r(i-2)+25*r(i-1)-50*r(i)+50*r(i+1)-25*r(i+2)+5*r(i+3))/24;
wave = 400+(i-1)*20;
w = linspace(wave+2,wave+18,19);
x = linspace(0.1,0.9,19);
y = a0+a1*x+a2*x.^2+a3*x.^3+a4*x.^4+a5*x.^5;
hold on
plot(w,y,'ro')
end
小弟想要把圖畫成這樣
http://imgur.com/a/4wIxA
但我打出來後會變這樣
http://imgur.com/a/VkTIA
我的程式碼是按照書上打的,也檢查很多次都沒錯
請問各位神人可以幫我看看哪邊出錯嗎
拜託了