I need to understand what's the mistake and how to define vector

1 view (last 30 days)
Hello,
I'm very new to MATLAB and I somehow learnt how to do modelling from the onramp course offered by the official course. The equations are accoring to the thermal modelling or some mass balancing from my thesis reference that I learnt but that i not an issue. This is a bit crutial for me because I'm at the end stage of my thesis work and I need to finish my course as soon as possible. I'm stuck with this situation that I cannot solve this. Please I'm in need of help
The error what I'm getting is {{Undefined function or variable 'u'. Function 'Producer/Producer' (#102.159.163), line 7, column 10: "u(2)"}}
  5 Comments
Walter Roberson
Walter Roberson on 20 Sep 2022
The variable truly is undefined at that point. We could guess that maybe u_p should be used in the code instead of u but since there is no documentation and the single comment does not describe any of the variables, it is only a guess.

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 20 Sep 2022
When MATLAB runs line 7 of your code, it tries to access the second element of the variable u (or to call a function named u with one input, the number 2.)
Assuming you actually intended to index into a variable named u, where on any of the previous lines (lines 1 through 6) did you define the variable u?
I agree with Walter that you likely meant to index into u_p on lines 7 and 8 instead of u.

Categories

Find more on Simulink in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!