フィルターのクリア

help with quadratic function graph

1 回表示 (過去 30 日間)
random1072
random1072 2020 年 4 月 16 日
コメント済み: Ameer Hamza 2020 年 4 月 16 日
need help making a quadratic growth graph where the maximum of 22.0 is at center with 0.55 on the ends. The x range is from 1 - 15 so need 0.55 at 1 and 0.55 at 15 with 22 at 8. please help

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 16 日
Try this
x = [1 8 15];
y = [0.55 22 0.55];
ft = fittype('a*x^2+b*x+c');
fit_quad = fit(x',y',ft);
xv = linspace(x(1), x(end), 100);
yv = fit_quad(xv);
plot(xv,yv);
xlim([x(1) x(end)]);
ylim([0.55 22]);
  2 件のコメント
random1072
random1072 2020 年 4 月 16 日
It did work thank you, only thing I’m getting a warning for is that it says “warning: start point not provided, choosing random start point”
Ameer Hamza
Ameer Hamza 2020 年 4 月 16 日
This is not an issue. This is just a warning that the function is choosing a random initial point for the optimization algorithm. You can suppress this warning by providing your own starting point
fit_quad = fit(x',y',ft, 'StartPoint', rand(1,3));

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by