Error using symengine and matrix must be square
Ältere Kommentare anzeigen
While typing the following I get this error:
- error using symengine
- matrix must be square
A= [(2.*s +2) - (2.*s + 1) -1 -(2.*s +1)*(9.*s +1) -4.*s -1 -4.*s*(4.*s +1 +1./s)];
>> B= [I1;I2;I3];
>> C=[V;0;0];
>> B= inv(A).*C;
Error using symengine
Matrix must be square.
Where does the error comes from and how can I solve it?
4 Kommentare
Ameer Hamza
am 10 Sep. 2020
Bearbeitet: Ameer Hamza
am 10 Sep. 2020
A is 1x6 matrix. What do you expect the output of inv(A) to be?
Jordy Mopewou
am 10 Sep. 2020
Ameer Hamza
am 10 Sep. 2020
Can you share the mathematical form of the equation you are trying to solve?
Jordy Mopewou
am 10 Sep. 2020
Akzeptierte Antwort
Weitere Antworten (1)
Ameer Hamza
am 10 Sep. 2020
An alternate solution is to use the inv() or mldivide (\) operator to solve the equation. Since this seems to be the lalpalce transform of a circuit, the following also shows how to get the time-domain solution for a specific voltage signal (v).
syms s V(s) t
A = [(2*s+1) -(2*s+1) -1;
-(2*s+1) (9*s+1) -4*s;
-1 -4*s (4+1+1/s)];
C = [V; 0; 0];
I = A\C; % same as inv(A)*B but more efficient
% Let v is a constant signal, i.e., v=1
V1 = 1/s;
I1 = subs(I, V, V1);
i(t) = ilaplace(I1, s, t);
tv = 0:0.01:1;
iv = double(subs(i, t, tv));
plot(tv, iv.');

1 Kommentar
Jordy Mopewou
am 12 Sep. 2020
Kategorien
Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
