undefined function or variable s

I am trying to solve a system of equations with many variables. I am trying to use linear algebra with Ax=b. I am having trouble creating the coefficient matrix A. These are the matrix I am trying to create:
A = [s*A + (1/(s*B)) + (1/(s*C)), 1/(s*C) ; -1/(s*C) , (1/(s*C)) + s*D + (1/E)]
x = [Va ; Vo]
b = [Vin*s*A ; 0]
When creating A I get an undefined function or variable 's' error. Is this possible with many unsolved variables? Any help would be greatly appreciated. Thank you.

댓글 수: 3

Rik
Rik 2017년 4월 24일
If you are trying to solve equations, at least use sym s to create s as a symbolic variable.
You can't use any undefined variables in Matlab. It needs to know what you are talking about, even if it may seem obvious to you.
I think you need to have a look at the documentation for solve, and you should have a look at some tutorial on Matlab.
Star Strider
Star Strider 2017년 4월 24일
Your problem is also not linear. My guess is that you are solving for ‘A’...‘E’. ‘Linear’ is defined as ‘linear in the parameters’, meaning that the partial derivatives of your objective function with respect to each parameter are not functions of themselves or other parameters. That is not true for your ‘A’ matrix (that you need to rename if one of your parameters is also called ‘A’).
Vin
Vin 2017년 4월 24일
Thank you both for your help! Using "syms" solved my problem. I didn't realize I had to define each variable before I created my matrices. Thanks again!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

Vin
2017년 4월 24일

댓글:

Vin
2017년 4월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by