How do I solve this issue, Error using vertcat Dimensions of arrays being concatenated are not consistent. Error in (line 22) A = [G1 +G2 +G3 -G1 -G2;

2 views (last 30 days)
clear
% MATLAB Componets Values
m = 10^-3
k = 10^3
Is = 2*m
Vs = 6
R1 = 1*k
R2 = 2*k
R3 = 3*k
R4 = 4*k
% MATLAB Solve for Vs, V1, and Vo
G1 = 1/R1
G2 = 1/R2
G3 = 1/R3
G4 = 1/R4
A = [G1 +G2 +G3 -G1 -G2;
G2 -G2 +G4]
B = [Is;
0]
x = inv(A)*B
V1 = x(1)
V0 = x(2)

Answers (1)

Image Analyst
Image Analyst on 8 Feb 2025
Your top row of A has 5 elements (columns) and you're trying to put a row under it that has only 3 elements (columns). You can't put a 3-element vector underneath a 5-element vector. All rows must have the same number of columns.

Categories

Find more on Operators and Elementary Operations 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!