undefined variable problem using vpasolve
Show older comments
So i need to solve a set of equations and wrote some code for that. Im not very confident in my matlab skills but i cant find the mistake in here. Im getting undefined variable error over and over again.
Heres the Code maybe someone here can help me.
% Parameter
A_1 = 8.23714;
A_2 = 8.19625;
B_1 = 1592.864;
B_2 = 1730.63;
C_1 = 226.184;
C_2 = 233.426;
c1 = 1.701;
c2 = 0.9425;
p = 1022.48; % [mbar]
T = 80; % [°C]
g1 = exp((c1.*((1-x1)).^2)./(((1-x1)+(c1/c2).*x1).^2));
g2 = exp((c2.*(x1).^2)./((x1+(c2/c1).*(1-x1)).^2));
p1 = 10^(A_1-(B_1./(T+C_1)));
p2 = 10^(A_2-(B_2./(T+C_2)));
syms x1
eqn = (g1.*p1.*x1)+(g2.*p2.*(1-x1))-p==0;
S = vpasolve(eqn,x1)
1 Comment
Walter Roberson
on 2 Jul 2023
syms x1 before you define g1 since g1 and g2 use x1
Accepted Answer
More Answers (0)
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!