How to solve equation which consist of cell array 6x6, matrices and variables?
7 views (last 30 days)
Show older comments
I am trying to solve a equation (eq. is written below). I am facing many problems in order to get final result. What i need is S_eff at the end as 6x6 cell array.
How to solve such equations which consist of cell array 6x6, matrices and variables?
Please suggest me best possible ways to solve this equaiton? kindly
Equation is:
S_eff = S_d + (((S_d - S_m) * I6 * (S_d - S_m))/(phi*(I2*S_m*I2' - 1/k_f) - I2*(S_d - S_m)*I2'));
% Here, S_d,S_m, are 6x6 cell array while phi and 1/k_f are single values say phi=0.2, k_f=2
% I2 =[1 1 1 0 0 0]; 1x6 matrix
% I6 = I2'*I2; 6x6 matrix
0 Comments
Answers (1)
Vedant Shah
on 27 Jun 2025
To solve the provided equation, it is important to convert the cell arrays ‘S_d’ and ‘S_m’ into matrices before performing matrix operations. The ‘cell2mat’ function can be used for this conversion. Once the necessary calculations are completed on the matrices, the result can be converted back to a cell array using the ‘mat2cell’ function.
The following code snippet demonstrates this approach:
S_d_mat = cell2mat(S_d);
S_m_mat = cell2mat(S_m);
numerator = (S_d_mat - S_m_mat) * I6 * (S_d_mat - S_m_mat);
denominator = phi * (I2 * S_m_mat * I2' - 1/k_f) - I2 * (S_d_mat - S_m_mat) * I2';
S_eff_mat = S_d_mat + numerator / denominator;
S_eff = mat2cell(S_eff_mat, ones(1,6), ones(1,6));
This code effectively solves the equation and provides the desired result as a 6x6 cell array.
For more information, refer to the following documentation:
0 Comments
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!