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

137 次查看(过去 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 个评论
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 CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by