Receiving Matrix Dimensions Do Not Agree Error

1 Ansicht (letzte 30 Tage)
Matt Stevenson
Matt Stevenson am 4 Mär. 2015
Kommentiert: Matt Stevenson am 4 Mär. 2015
My MatLab script is:
R3=100; R4=2000; R5=50; R6=4000; R7=5000; V1=5; V2=3; I8=.008;
A= [0 0 0 0 0 0 0 1 -1 0 0 0 0; 0 0 0 0 0 0 0 0 0 0 0 1 -1; 0 0 0 0 0 0 -1 0 0 0 1 0 0; 0 0 0 0 0 0 1 0 0 0 0 -1 0; 0 0 0 0 0 0 0 0 1 -1 0 0 1; 0 0 1 1 0 1 0 0 0 0 0 0 0; -1 0 0 0 1 -1 0 0 0 0 0 0 0; 0 -1 0 -1 -1 0 0 0 0 0 0 0 0; 1 0 0 0 0 0 0 0 -R3 0 0 0 0; 0 1 0 0 0 0 0 0 0 -R4 0 0 0; 0 0 1 0 0 0 0 0 0 0 -R5 0 0; 0 0 0 1 0 0 0 0 0 0 0 -R6 0; 0 0 0 0 1 0 0 0 0 0 0 0 -R7];
Y= [0 I8 0 0 0 -V1 V2 0 0 0 0 0 0];
X=inv(A)*Y;
I have checked the dimensions over and over again and they appear to agree. What am I doing wrong?

Akzeptierte Antwort

Shoaibur Rahman
Shoaibur Rahman am 4 Mär. 2015
Instead of Y use Y transpose as Y' in the last line of your code.
X=inv(A)*Y'
However if you use the following line instead, it will be more efficient, but you doing all right.
x = A\Y'

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by