syntax error for matrix
이전 댓글 표시
I get the error on the first open bracket, here's the code.
close all; clear all;
syms s V;
A = [3+2+1*s 1*s+2 -3; -s-2 2+1*s+2*s+4*s -2*s; -3 -2*s 3+(1/(2*s))+2s];
B = [V;0;0];
[I]=linsolve(A,B);
답변 (1개)
Typo:
A = [3+2+1*s 1*s+2 -3; -s-2 2+1*s+2*s+4*s -2*s; -3 -2*s 3+(1/(2*s))+2s]
↑ ← MISSING MULTIPLICATION OPERATOR
Correct that, and it runs without error —
syms s V
sympref('AbbreviateOutput',false);
A = [3+2+1*s 1*s+2 -3; -s-2 2+1*s+2*s+4*s -2*s; -3 -2*s 3+(1/(2*s))+2*s];
B = [V;0;0];
[I]=linsolve(A,B)
.
댓글 수: 5
Thomas O'Reilly
2021년 12월 6일
My pleasure!
It gives me output (as demonstrated), so I guess that depends on the definition of ‘output’.
Numeric output would require that the functions be evaluated at one (or more) values of the Laplace variable s with specific values of V, although that may be variable as well (for example an A-C voltage source, although that could be modeled by a Laplace transform as well).
Simplifying them may provide some benefit —
syms s V
sympref('AbbreviateOutput',false);
A = [3+2+1*s 1*s+2 -3; -s-2 2+1*s+2*s+4*s -2*s; -3 -2*s 3+(1/(2*s))+2*s];
B = [V;0;0];
[I]=simplify(linsolve(A,B), 500)
However I’m not certain that provides much additional clarity.
This is the best I can do.
.
Thomas O'Reilly
2021년 12월 6일
Thomas O'Reilly
2021년 12월 6일
Star Strider
2021년 12월 6일
The typeset (LaTeX) output is the default here with the online Run feature. The same is also possible using the Live Editor (that I use occasionally), or by using the latex function and then a LaTeX interpreter. See The (Not So) Short Introduction to LaTeX2e - lshort.pdf for more details on LaTeX.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

