Nikolaj
Nikolaj

Reputation: 25

Matlab: Error using sin (squared)

theta = (0:0.01:2*pi)

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

it returns me this error;

Error using sin. Not enough input arguments.

I am confused, what do i need to change?

Upvotes: 0

Views: 23217

Answers (2)

Sam Roberts
Sam Roberts

Reputation: 24127

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

Upvotes: 1

WheretheresaWill
WheretheresaWill

Reputation: 6480

I think sine squared can be done with either:

sin(x).*sin(x)

or

sin(x).^2

Upvotes: 1

Related Questions