[繪圖] 無法跑出極點

作者: pigymjh (小黑)   2017-12-28 02:46:23
小弟最近剛學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
圖有跑出來但極值沒有出來
請問是哪裡寫錯
作者: LiamIssac (Madchester)   2017-12-28 05:41:00
你的指令沒有標示該點啊 只有畫圖而以 google一下怎麼標示某個點 一般matlab書籍都會教
作者: pigymjh (小黑)   2017-12-29 00:06:00
好的 感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com