作者pigymjh (小黑)
看板MATLAB
標題[繪圖] 無法跑出極點
時間Thu Dec 28 02:46:23 2017
小弟最近剛學MATLAB
要求方程式極值並標示在圖上
clear
for i =0:6000;
t=i*0.001;
y=0.2*t.^6-4*t.^5+31.2*t.^4-119.6*t.^3+232.6*t.^2-212.2*t+70;
plot(t,y)
set(gca,'ytick',[-6 -4 -2 0 2 4 6 8 10]);
axis([0, 6, -6, 10]);
grid on;
hold on;
end;
t=0:1:6;
y=0.2*t.^6-4*t.^5+31.2*t.^4-119.6*t.^3+232.6*t.^2-212.2*t+70;
n=length(t);
for ii=1:n;
for jj=ii+1:n;
if y(ii) < y(jj);
temp=y(jj);
plot(temp,'bo');
hold on;
end
end
end
圖有跑出來但極值沒有出來
請問是哪裡寫錯
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 27.247.134.28
※ 文章網址: https://webptt.com/m.aspx?n=bbs/MATLAB/M.1514400385.A.F8A.html
1F:→ LiamIssac: 你的指令沒有標示該點啊 只有畫圖而以 google一下怎麼 12/28 05:41
2F:→ LiamIssac: 標示某個點 一般matlab書籍都會教 12/28 05:41
3F:→ pigymjh: 好的 感謝 12/29 00:06