MATLAB中cosh/sinh大值计算NaN问题及弹性恢复系数积分求助
Alright, let's walk through the hurdles you're hitting with your MATLAB calculations and the temporary fix you've landed on:
MATLAB Numerical Issues & Workaround for Radius Integration
- Hyperbolic Function Overflow:When
xfalls between 700 and 1000, calculatingcosh(x)andsinh(x)throws backNaNbecause the values blow past MATLAB's numerical limits. This is the main reason your integration over the radius range is stuck. - Elastic Restor Coeff Anomaly:Your
elastic_restor_coeffvariable shoots up when the radius drops below5e-9. Since you need to integrate across radii from1e-9to100e-9, this unexpected spike adds extra instability to your computations. - Temporary Stopgap Fix:To keep progress moving, you're approximating the real part of
chi_parawith a step function oncethreshold2reaches a specific value. This bypasses the NaN-induced calculation halt, though it's just a short-term workaround for now.
If you're aiming for a more robust long-term solution, consider exploring two avenues:
- Rewrite the hyperbolic function calculations using logarithmic transformations (since
cosh(x)andsinh(x)can be expressed via exponentials, which are easier to handle with logs for largexvalues) - Use MATLAB's
vpa(Variable-Precision Arithmetic) tool to handle the large numerical ranges without hitting overflow limits
内容的提问来源于stack exchange,提问作者Nabs
相关产品推荐
相关产品推荐

