Dimensions of arrays being concatenated are not consistent
1 view (last 30 days)
Show older comments
I am following the guide for a problem that involves matrices and the goal of this code is to be able to input values simply by using a keyboard. However, I keep getting this error code that I listed in the title even though I am following the guide exactly. Any and all help is greatly appreciated.
R1 = ('Input the value of R1: ');
R2 = ('Input the value of R2: ');
R3 = ('Input the value of R3: ');
R4 = ('Input the value of R4: ');
R5 = ('Input the value of R5: ');
V = ('Input the value of voltage, V: ');
coef = [(R2 + R4), -R2, -R4;
-R2, (R1 + R2 + R3), (-R3);
-R4, -R3, (R3 +R4 + R5)];
result = [V; 0; 0];
I = inv(coef)*result
Error using vertcat
Dimensions of arrays being concatenated are not consistent.
Error in Mini_Project_3_Part4 (line 10)
result = [V; 0; 0]
Accepted Answer
KSSV
on 3 Nov 2020
R1 = input('Input the value of R1: ');
R2 = input('Input the value of R2: ');
R3 = input('Input the value of R3: ');
R4 = input('Input the value of R4: ');
R5 = input('Input the value of R5: ');
V = input('Input the value of voltage, V: ');
coef = [(R2 + R4), -R2, -R4;
-R2, (R1 + R2 + R3), (-R3);
-R4, -R3, (R3 +R4 + R5)];
result = [V; 0; 0];
I = inv(coef)*result
More Answers (0)
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!