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 Kommentare

Rik
Rik am 24 Apr. 2017
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 am 24 Apr. 2017
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 am 24 Apr. 2017
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!

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Gefragt:

Vin
am 24 Apr. 2017

Kommentiert:

Vin
am 24 Apr. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by