Matlab - 将矩阵提升到幂的维度不正确 [英] Matlab - Incorrect dimensions for raising a matrix to a power

查看:238
本文介绍了Matlab - 将矩阵提升到幂的维度不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有 a=60B=60.我正在尝试计算这个区域:

Suppose we have a=60 and B=60. I am trying to calculate this area:

当我尝试这个时:

W = ((u^2)* cot(B) + (v^2 * cot(a))/8;

我收到此错误:

将矩阵提升到幂的维度不正确.检查矩阵是否为方阵,幂是否为标量.要执行逐元素矩阵幂,使用'.^'.

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 '.^'.

如何正确使用u^2?

推荐答案

如果 uv 是向量,你应该写 u.^2v.^2 代替(元素操作符).当你写 u^2 意味着 u * u 而这并不意味着 u 不是一个平方矩阵.

If u and v are a vector, you should write u.^2 and v.^2 instead (an element-wise operator). When you write u^2 means u * u and it does not mean when u is not a squared matrix.

但是,如果它们是向量,则不用于计算W的值.

However, if they are vector, it is not meant for computing the value of W.

这篇关于Matlab - 将矩阵提升到幂的维度不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆