Clear Filters
Clear Filters

Fed-batch modelling

2 views (last 30 days)
Christy
Christy on 22 May 2024
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?

Answers (1)

prabhat kumar sharma
prabhat kumar sharma on 3 Jun 2024
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!

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!