題目:
matlab多項(xiàng)式畫圖已知多項(xiàng)式為y=1.4017*10^(1/24)*x^10-8.0132*10^(1/21)*x^9+1.96*10^(1/17)*x^8-2.6776*10^(1/14)*x^7+2.2366*10^(1/11)*x^6-1.1746*10^(1/8)*x^5+3.8326*10^(1/6)*x^4-0.0007347*x^3+0.072265*x^2-2.5331*x+25.817,x的取值范圍是0到1080.編碼:x=1:5:1080;y=1.4017*10^(1/24)*x^10-8.0132*10^(1/21)*x^9+1.96*10^(1/17)*x^8-2.6776*10^(1/14)*x^7+2.2366*10^(1/11)*x^6-1.1746*10^(1/8)*x^5+3.8326*10^(1/6)*x^4-0.0007347*x^3+0.072265*x^2-2.5331*x+25.817;plot(x,y);錯(cuò)誤是:y=1.4017*10^(1/24)*x^10-8.0132*10^(1/21)*x^9+1.96*10^(1/17)*x^8-2.6776*10^(1/14)*x^7+2.2366*10^(1/11)*x^6-1.1746*10^(1/8)*x^5+3.8326*10^(1/6)*x^4-0.0007347*x^3+0.072265*x^2-2.5331*x+25.817;|Error:Missing variable or function.請(qǐng)問(wèn)如何改正
解答:
用手工加點(diǎn)太麻煩了,還容易出錯(cuò),最好用函數(shù):clc;clearx=1:5:1080;y="1.4017*10^(1/24)*x^10-8.0132*10^(1/21)*x^9+1.96*10^(1/17)*x^8-2.6776*10^(1/14)*x^7+2.2366*10^(1/11)*x^6-1.1746*10^(1/8)*x^5+3.8326*10^(1/6)*x^4-0.0007347*x^3+0.072265*x^2-2.5331*x+25.817";y=vectorize(y)y=eval(y);plot(x,y);結(jié)果:y =1.4017.*10.^(1./24).*x.^10-8.0132.*10.^(1./21).*x.^9+1.96.*10.^(1./17).*x.^8-2.6776.*10.^(1./14).*x.^7+2.2366.*10.^(1./11).*x.^6-1.1746.*10.^(1./8).*x.^5+3.8326.*10.^(1./6).*x.^4-0.0007347.*x.^3+0.072265.*x.^2-2.5331.*x+25.817
1.《matlab畫圖 matlab多項(xiàng)式畫圖》援引自互聯(lián)網(wǎng),旨在傳遞更多網(wǎng)絡(luò)信息知識(shí),僅代表作者本人觀點(diǎn),與本網(wǎng)站無(wú)關(guān),侵刪請(qǐng)聯(lián)系頁(yè)腳下方聯(lián)系方式。
2.《matlab畫圖 matlab多項(xiàng)式畫圖》僅供讀者參考,本網(wǎng)站未對(duì)該內(nèi)容進(jìn)行證實(shí),對(duì)其原創(chuàng)性、真實(shí)性、完整性、及時(shí)性不作任何保證。
3.文章轉(zhuǎn)載時(shí)請(qǐng)保留本站內(nèi)容來(lái)源地址,http://f99ss.com/jiaoyu/550495.html