HELP required: Undefined function 'mpower' for input arguments of type 'cell' ... Plus another error!
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My aim is to have a expression for 'd' in terms of other variables (L, D & k) and here is the code:
syms L D k d;
n = 10;
t = (L-D)/n;
x1 = 0;
F1 = 0;
x2 = 0;
F2 = 0;
for i = 0:((n-2)/2)
x1 = (2*i+1)*t;
F1 = F1 + k*[(L-D)^2-x1^2] / {{1 - [k*[(L-D)^2-x1^2]]^2}^(1/2)};
end
for i = 1:((n-2)/2)
x2 = 2*i*t;
F2 = F2 + k*[(L-D)^2-x2^2] / {{1 - [k*[(L-D)^2-x2^2]]^2}^(1/2)};
end
d = t*{k*(L-D)^2+4*F1+2*F2}/3;
The ERRORS are as follows:
{
Undefined function 'mpower' for input arguments of type 'cell'.
Error in Symbolictest (line 10)
F1 = F1 + k*[(L-D)^2-x1^2] / {{1 - [k*[(L-D)^2-x1^2]]^2}^(1/2)};
}
0 commentaires
Réponses (1)
Star Strider
le 10 Mai 2015
The curly brackets {} create a cell. Replace them with parentheses:
F1 = F1 + k*[(L-D)^2-x1^2] / ((1 - [k*[(L-D)^2-x1^2]]^2)^(1/2));
and:
F2 = F2 + k*[(L-D)^2-x2^2] / ((1 - [k*[(L-D)^2-x2^2]]^2)^(1/2));
and:
d = t*(k*(L-D)^2+4*F1+2*F2)/3;
Also, you need to subscript the variables you want to keep that you create in your for loops. Otherwise, you are keeping only the result of the last iteration.
This should eliminate the ‘cell’ errors. I leave it to you to troubleshoot the rest of your code.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!