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

조회 수: 143 (최근 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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by