No solution for a solve function that has a solution?

I have a problem with using the solve function here:
xA_R = [];
yA_P = [];
dA = [];
thetaRange = linspace(0.00001, cut_Rspecified, 1000);
for i = 1:length(thetaRange)
syms y2
x = solve(thetaRange(i) == (.21 - x) / (y2 - x), x);
eqn6 = y2 == x^(1 / (1 - alpha_HF)) * (1 - thetaRange(i)) / thetaRange(i) * ((1 - x)^(alpha_HF / (alpha_HF - 1)) *...
(0.21 / (1 - 0.21))^(alpha_HF / (alpha_HF - 1)) - x^(alpha_HF / (alpha_HF - 1)));
yA_P(i) = vpasolve(eqn6, y2)
xA_P = solve(thetaRange(i) == (.21 - x) / (yA_P(i) - x), x)
Perm_O2 = 15 * 10^3 * 10^-10 * 0.000045 * 5.17 * 3600; %Convert units
dA(i) = (yA_P(i) * dTheta * nF) / (Perm_O2 * (xA_R * 500 - yA_P * 20));
end
Every time I run this, I get a empty 0 by 1 sym for xA_P, but yA_P evaluates to a numerical answer. I have no idea why. Can someone explain to me why? I am using Matalab 2015, if that may be why.

Risposte (1)

I had to make a series of assumptions to get this to work. Code attached.
It turned out not to be possible to vectorize this.
The outcome is nearly but not exactly a straight line.

Categorie

Richiesto:

il 28 Nov 2017

Risposto:

il 28 Nov 2017

Community Treasure Hunt

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

Start Hunting!

Translated by