Can't find the maximum on the graph of a function
3 次查看(过去 30 天)
显示 更早的评论
Hello! I'm not sure how to answer this homework problem I have. I've gotten halfway through the code and have done an fplot, but I can't find anything on how to plot the max of an fplot/find the max of an fplot. The problem is below:

This is my code so far:
t = [0:30];
h = height(t);
fplot(height(t),[0,30])
function h=height(t);
h=@(t) (-(9.8/2).*t.^2)+(125.*t)+500
end
Adding a max value just creates a huge error message, and I'm not sure why:
t = [0:30];
h = height(t);
fplot(height(t),[0,30])
[max_t,max_h]=max(height(t))
function h=height(t);
h=@(t) (-(9.8/2).*t.^2)+(125.*t)+500
end
0 个评论
采纳的回答
KSSV
2019-3-8
t = 0:30;
h = (-(9.8/2).*t.^2)+(125.*t)+500 ;
[val,idx] = max(h) ;
h_max = val ;
t_max = t(idx) ;
plot(t,h)
hold on
plot(t_max,h_max,'*r')
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!