Variable x must be of size [2 1]. It is currently of size [2 2]. Check where the variable is assigned a value.

136 ビュー (過去 30 日間)
All lines except the 8th comes up as correct but line 8 comes up as incorrect and states the reason "Variable x must be of size [2 1]. It is currently of size [2 2]. Check where the variable is assigned a value."
How can i change this code to get a [2 1] matrix instead of [2 2] ?

採用された回答

KSSV
KSSV 2020 年 5 月 18 日
A = [1 2 4 5 7 ; 9 2 1 4 13] ;
B = [-11 2 ; 3 -1 ; 2 0; 5 11 ; -21 1];
C = A*B ;
D = B*A ;
s = det(C) ;
t = det(D) ;
x = inv(C).*[8 -1].^t ;
  10 件のコメント
Sithum Nanayakkara
Sithum Nanayakkara 2020 年 5 月 25 日
Here :
D = [-3,-18,1,-47,3;2,4,2,11,1;1,4,3,10,8;1,32,4,69,5;7,-40,5,-101,-1];
b = [11;3;7;-17;1];
x = linsolve(D,b) ;
KSSV
KSSV 2020 年 5 月 25 日
clc; clear all ;
D = [-3 -18 1 -47 3 ;
2 4 2 11 1 ;
1 4 3 10 8 ;
1 32 4 69 5 ;
7 -40 5 -101 -1] ;
b = [11 ; 3 ;7 ;-17 ;1] ;
x = D\b

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by