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!