フィルターのクリア

plotting a matrix( polynomial order )

1 回表示 (過去 30 日間)
Amjad Green
Amjad Green 2018 年 4 月 16 日
回答済み: Star Strider 2018 年 4 月 16 日
the matrix is [r,c] size
each row should have an equation of x^(c-1) +x^(c-2) ... i need the functions to plot on the same graph
for example A=[2 5 8;-3 4 6]
first equation should be 2.*(x.^2) +5.*x +8
second equation should be -3.*(x.^2)+4.*x +8
example2 A=[4 2;3 5]
f1=4.*x +2
f2=3.*x+5

採用された回答

Star Strider
Star Strider 2018 年 4 月 16 日

Use the polyval function:

A1 = [2 5 8;-3 4 6];
A2 = [4 2;3 5];
x = linspace(-5, 5);                                    % Arbitrary ‘x’
figure(1)
Axh = axes('NextPlot','add');
for k1 = 1:size(A1,1)
    y = polyval(A1(k1,:),x);
    plot(Axh, x, y)
end
grid
figure(2)
Axh = axes('NextPlot','add');
for k1 = 1:size(A2,1)
    y = polyval(A2(k1,:),x);
    plot(Axh, x, y)
end
grid

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by