三个自定义函数profit3,profit22和profit已经写好了,但是作图的时候,我希望的是可以出一组图,但最后运行的结果只是出现了gap1 和gap2的两个值。
Xi = 5:5:100
profit3 = calucate_profit3(Xi)
profit2 = calucate_profit2(Xi)
profit = calucate_profit(Xi)
gap1 = (profit3-profit)/profit
gap2 = (profit2-profit)/profit
plot(Xi,gap1,'--',Xi,gap2,'-')

 採用された回答

新锦江官方网站【359663.tv】
新锦江官方网站【359663.tv】 2022 年 10 月 13 日

0 投票

先确定你的函数能针对输入向量Xi求得输出向量profit
然后在gap1 = (profit3-profit)/profit
这种地方改成点除gap1 = (profit3-profit)./profit

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で 二维图和三维图 についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!