What is the correct equation?

1 次查看(过去 30 天)
>> t=linspace(0,2*pi,100);
>> y=5*t.*(sin(t).^2)-t.^2*(cos(t).^2);
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the
number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
The equation I'm trying to input is: y=5*t*sin^2(t)-(t^2)*cos^2(t)

采纳的回答

Walter Roberson
Walter Roberson 2019-1-30
y=5*t.*(sin(t).^2)-t.^2.*(cos(t).^2);
You should probably get in the habit of always using .* and .^ and ./ every time, until you finally encounter a situation where you need to use inner product * or matrix exponential ^ or least squared solutions to equations /

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multidimensional Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by