【问题标题】:Matlab: Error using sin (squared)Matlab:使用 sin(平方)的错误
【发布时间】:2013-03-28 09:27:48
【问题描述】:
theta = (0:0.01:2*pi)

r = sin.^2.*(theta) + cos.^2.*(theta)

它返回这个错误;

使用 sin 时出错。输入参数不足。

我很困惑,我需要改变什么?

【问题讨论】:

  • 你知道sin(x).^2 + cos(x).^2 = 1是一个三角恒等式,所以r永远是1吗?
  • 哈哈是的,但它不是未定义的,theta 是上面显示的向量的变量,所以它不会等于 1

标签: matlab trigonometry


【解决方案1】:

我认为正弦平方可以通过以下任一方式完成:

sin(x).*sin(x)

或

sin(x).^2

【讨论】:

    【解决方案2】:

    r = (sin(theta)).^2 + (cos(theta)).^2

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-14
      • 2015-04-14
      • 1970-01-01
      • 1970-01-01
      • 2011-01-02
      • 1970-01-01
      相关资源
      最近更新 更多