MATLAB: How to solve equations with data stored in a cell arrays

cell arrayeqnsolve

Hi I am trying to solve the following equation: Eqn = (a/2)*log((Rs+a)/(Rs-a))== Ind; I can solve it for individual values of Ind using the functions solve as follows:
Ind = 13;
Rs = 5;
syms a
Eqn = (a/2)*log((Rs+a)/(Rs-a))== Ind;
Sol = solve(Eqn,a);
The problem comes when Ind data are stored in a cell array cell(1,n) and each cell contains (m x n) arrays. I would like to solve the equation for the first column of the array contained at each cell and organize the solution also in a cell array where sol{i}(1:end) comes from Ind{i}(1:end,1) I have tried:
Ind = cell(1,10);
Sol = cell(1,10);
Eqn = cell(1,10);
for i = 1:10
Ind{i} = (0:3:15)';
end
Rs = 5;
for i = 1:10
syms a
Eqn{i} = (a/2)*log((Rs+a)/(Rs-a))== Ind{i}
Sol{i} = solve(Eqn{i},a);
end
But of course it does not work. I have also tried other combination and even indexing the data with two for loops taking i and j for numbering cell number and row but I just have no idea how to treat these kind of data. Thanks a lot in advance for any advice!!!

Best Answer

I would simply do this:
syms a
Ind = 13;
Rs = 5;
Ind = 0:3:15;
for i = 1:numel(Ind)
Sol{i} = solve((a/2)*log((Rs+a)/(Rs-a))== Ind(i),a);
end
Related Question