How to use while loop for Matrix operation using Backslash

10 ビュー (過去 30 日間)
Parth Luhar
Parth Luhar 2022 年 7 月 15 日
回答済み: Star Strider 2022 年 7 月 16 日
I have matrix D as N*M and matrix T as a M*1 now my result is X matrix which is obtained using X = D\T basically to solver system of linear equation.
Now I want to use while loop for this operation as I want the values of X which is also M*1 matrix under a certain tolerance.
Any guidence will be helpful.
  2 件のコメント
Torsten
Torsten 2022 年 7 月 15 日
Now I want to use while loop for this operation as I want the values of X which is also M*1 matrix under a certain tolerance.
Not clear what you mean.
Parth Luhar
Parth Luhar 2022 年 7 月 16 日
If you can share your email address I will explain the problem in detail if you do not mind,

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

採用された回答

Star Strider
Star Strider 2022 年 7 月 16 日
Perhaps —
D = randn(10,4);
T = randn(10,1);
v1 = ones(size(T));
for k = 1:size(D,2)
X(:,k) = [D(:,k) v1] \ T;
vr(:,k) = linspace(min(D(:,k)), max(D(:,k)), numel(T)).';
LR(:,k) = [vr(:,k) v1] * X(:,k);
end
NrSP = size(D,2); % Number Of subplots
figure
for k = 1:NrSP
subplot(NrSP/2,2,k)
plot(D(:,k), T, '.')
hold on
plot(vr(:,k), LR(:,k), '-r')
hold off
grid
title(sprintf('Column %2d',k))
end
.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by