Domain error. To compute complex results from real x, use 'log(complex(x))'

4 ビュー (過去 30 日間)
Atharva Bhomle
Atharva Bhomle 2023 年 7 月 5 日
回答済み: Sai Pallav 2023 年 7 月 5 日
I am calculating v_model as
v_model=e0 + i*r - (k0/soc) - (k1*soc) + k2*(log(soc)) + k3*(log(1-soc))
Other all parameters I have given to the matlab function block which calculates the above equation.
At t=0 in simulink, i have set soc=0.995
But when it calculates log(1-soc) it gives domain error. When I connected physical blocks of substract and log it said input to log block is zero.
I don't know why simulink is taking 1-0.995 as zero.

採用された回答

Sai Pallav
Sai Pallav 2023 年 7 月 5 日
Hi Atharva,
Could you please provide the MATLAB version and more details of the process you are running. The log function in 2023a version is working fine. For example,
>> soc = 0.995;
>> log(1-soc)
ans =
-5.2983
So, I don't think the problem is in the log function.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating Custom Components and Libraries についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by