How to plot cost curve with conditions
3 次查看(过去 30 天)
显示 更早的评论
I want to calculate total cost graphically and created the following script. I got result for y = 0 10 20 30 40 50 30 35 40 45 50, however my desired result is y = 0 10 20 30 40 50 55 60 65 70 75.
Kindly help me in my desired results. I do not know what I am missing.
x=0:1:10;
z1 = (x<=5).*x;
z2 = (x>5).*x;
y = 10*z1 + 5*z2
plot(x,y)
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!