Please help me convert them into a function of theta
1 回表示 (過去 30 日間)
古いコメントを表示
Error using ^ (line 51)
Incorrect dimensions for raising a matrix to a power.
Check that the matrix is square and the power is a
scalar. To perform elementwise matrix powers, use '.^'.
I got this when I try to use the equation
Please help me convert them into a function of theta that i can plot as a (theta,x) to test from degree 0 to 360(0 to 2pi).
2 件のコメント
KSSV
2020 年 6 月 24 日
The error is clear....if you have a matrix, A if you want to find the power each element of A, use element by element power
A2 = A.^2
You attach the code, you tried..so you can get help.
回答 (1 件)
Bjorn Gustavsson
2020 年 6 月 24 日
When you get such an error, your first action would be to look at the sizes of the variables you use:
whos r wab L r theta
Next you'll have think about whether you want matrix-power or elementwise power (same with products - matrix-product or element-wise product). From your equation it seems as if you want elementwise operations, but we cannot know this with absolute certainty. In that case you'll have to modify your expression to something like this:
abc = (r.*(wab.^2)*(L.^2-r.^2).*sin(theta))./((L.*L-r.*r.*sin(theta).*sin(theta)).^(3/2));
HTH
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!