cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Given Find block only works with constant matrix

erichter7
1-Visitor

Given Find block only works with constant matrix

At the top of page 3, I have a constant matrix that is referenced in the solve block. Just above it I have a matrix with the same name that I computed. The solver finds the solution with the constant matrix. But if you delete the constant matrix so that it uses the computed one, it colors the find result in red and says "This variable is undefined" if I use v14. If I use an older version (2001) it says that the matrix must be square. Any help is much appreciated. I'm trying to get this to work for my freshman Electrical Engineering course - I thought Matlab would be too hard for them 🙂
2 REPLIES 2

It could very well be that "The matrix must be square", therefore "This variable is not defined above". Eventually, if you make the matrix square, the solver may just be "lsolve".

jmG

You are attempting a symbolic evaluation of the find, rather than a numeric evaluation. That is not a good use of a solve block (which is basically for numeric solutions) and often fails.

If you use the error trace facility, you can trace the error back to its source. The eventual error message is (as is often the case in MC14) completely off the wall and irrelevant. There is no division by zero. But you are attempting to divide a scalar by a vector. While the numeric processor will implicitly vectorize such an expression (giving an elelement by element result rather than a vector calculation) the symbolic processor will not. You need to explicitly vectorize the expression.

That allows the symbolic calculation of a result, but the result is not actually displayable. The problem is that you have used line in the calculations. Line is a numeric only function, the symbolic processor does not recognize it. So the symbolic result is in terms of the line function, and is much to big to be displayed.

Don't use symbolic evaluation unless you really need symbolic solutions, and then only if you fully understand the symbolic processor.
__________________
� � � � Tom Gutman
Announcements

Top Tags