Help on solving equation?

2 views (last 30 days)
ABDULLA RAHIL
ABDULLA RAHIL on 29 Apr 2019
Answered: Stephan on 29 Apr 2019
Hello,
I need urgent help for the small code belwo to solave the equation I jave tried but I always seeing this error ((Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters)).
Code is belwo:
A1=1.825*10^6;
Zi=67;
M=123;
B=50.29;
a=5;
Z=134;
AO0=2.6;
P0=54.6;
C=12;
Ka=2.45;
V=10^((-A1*(Zi^2)*sqrt(M))/(1+B*a*sqrt(M)));
syms A
eqn=AO0-(C*V*(A*(((1-Z*C^0.5)^(-1))+((AO0-P0)/(2*A))/(1+((AO0-P0)/(2*AO0))-(AO0/2)))*(Ka/AO0)-(A*(((1-Z*C^0.5)^(-1))+((AO0-P0)/(2*A))/(1+((AO0-P0)/(2*AO0)));
sola = solve(eqn, A)
  1 Comment
KALYAN ACHARJYA
KALYAN ACHARJYA on 29 Apr 2019
My suggestion break the eqn statement in multiple parts, because it is confusing check.

Sign in to comment.

Accepted Answer

Stephan
Stephan on 29 Apr 2019
Hi,
try:
A1=1.825*10^6;
Zi=67;
M=123;
B=50.29;
a=5;
Z=134;
AO0=2.6;
P0=54.6;
C=12;
Ka=2.45;
V=10^((-A1*(Zi^2)*sqrt(M))/(1+B*a*sqrt(M)));
syms A
eqn=AO0-C*V*A*(((1-Z*C^0.5)^(-1))+((AO0-P0)/(2*A))/(1+((AO0-P0)/(2*AO0))-(AO0/2)))*(Ka/AO0)-(A*(((1-Z*C^0.5)^(-1))+((AO0-P0)/(2*A))/(1+((AO0-P0)/(2*AO0)))));
sola = double(solve(eqn, A))
result is:
sola =
133.8103
Does this appear to be a correct result? If not check the parenthesis of your equation.
Best regards
Stephan

More Answers (0)

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!