I need to understand what's the mistake and how to define vector
1 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1130895/image.png)
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 个评论
Walter Roberson
2022-9-20
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.
回答(1 个)
Steven Lord
2022-9-20
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!