HELP required: Undefined function 'mpower' for input arguments of type 'cell' ... Plus another error!
6 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Star Strider
2015 年 5 月 10 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!