Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

請問matlab指令~多項式

已知一個二次多項式通過3點

其中那3點為 (1,-1),(2,3),(6,7)

求通過此3點的2次多項式

note:不是用手算喔~而是何種matlab指令可以跑出此2次多項式

請各位幫幫忙

1 Answer

Rating
  • Ryan
    Lv 5
    9 years ago
    Favorite Answer

    % 取樣點

    x = [1 2 6];

    y = [-1 3 7];

    p = polyfit(x,y,2);

    plot(x, y, 'x');

    % 測試點

    x_test = 0:0.5:7;

    y_test = polyval(p, x_test);

    hold on;

    plot(x_test, y_test, 'r-o');

    legend('取樣點', '測試點');

    title(poly2str(p, 'x'));

    圖片參考:https://lh3.googleusercontent.com/-PlvQftiJW7Y/UHZ...

Still have questions? Get your answers by asking now.