finding matrix base on linear equation

2 ビュー (過去 30 日間)
Nir Shwartz
Nir Shwartz 2022 年 1 月 18 日
回答済み: Star Strider 2022 年 1 月 18 日
hello,
given a linear quation, y=ax+b y=-0.15x-21.3, how can find a matrix for y=Ax?
thanks

回答 (1 件)

Star Strider
Star Strider 2022 年 1 月 18 日
I’m not certain what the desired result is here.
Try this —
x = linspace(-10, 10, 5);
y = -0.15*x-21.3;
X = [x(:), ones(size(x(:)))] % Design Matrix
X = 5×2
-10 1 -5 1 0 1 5 1 10 1
Coefficients = X \ y(:) % Proof
Coefficients = 2×1
-0.1500 -21.3000
.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by