Fed-batch modelling

3 次查看(过去 30 天)
Christy
Christy 2024-5-22
I am trying to make fed-batch modelling using simulink. However, this is not working and error: domain error. to compute complex results make at least one input complex e.g. 'power(complex(a)). I could not quite find the problem, as the formula itself seems off (eq. 5, seems like dV/dt does not have its own formula and more like a constant of F). Can you help me how to make the simulation work?

回答(1 个)

prabhat kumar sharma
Hi Christy,
The error message you've received about computing complex results usually indicates that a mathematical operation within your function is being performed on a value (or set of values) that is not within the valid domain of that operation. Common operations that can lead to this issue include square roots of negative numbers, logarithms of negative numbers, or improper use of exponents that result in complex numbers.
In your function, there are several operations that could potentially lead to domain errors if the inputs are not within a valid range.
I'll recommend you to follow below checks:
  1. Verify Mathematical Formulas: Double-check the mathematical formulas against your model or literature to ensure they are implemented correctly. Pay special attention to the units and make sure they are consistent across all calculations.
  2. Check Initial and Boundary Conditions: Ensure that all initial conditions (Cx0, Ce0, V0, etc.) and boundary conditions (like F, Csf, etc.) are physically plausible and within a realistic range. Incorrect initial conditions could lead to unexpected values that cause domain errors.
  3. Debugging Step-by-Step: Consider adding breakpoints or disp statements in your function to print out intermediate values of variables like u, Yxs, Yes, and the derivatives. This can help identify exactly where invalid values are first introduced.
  4. Correct dVdt Calculation: Review and correct the dVdt calculation to accurately reflect the rate of change of volume in the reactor, likely just dVdt = F.
You can check this post for better understanding of issue: https://www.mathworks.com/matlabcentral/answers/229261-runtime-error-call-to-matlab-function-aborted-domain-error-to-compute-complex-results-make-at-l
I hope it helps!

类别

Help CenterFile Exchange 中查找有关 Multicore Processor Targets 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by