Why the valid looking statement gives error in MATLAB?

Posted by user198729 on Stack Overflow See other posts from Stack Overflow or by user198729
Published on 2010-05-04T18:54:44Z Indexed on 2010/05/04 18:58 UTC
Read the original article Hit count: 194

Filed under:
|

It's from this question?

Why the two solutions doesn't work, though it looks very valid for me:

>> t = -pi:0.1:pi;
>> r = ((sin(t)*sqrt(cos(t)))*(sin(t) + (7/5))^(-1)) - 2*sin(t) + 2 ;
??? Error using ==> mtimes
Inner matrix dimensions must agree.

>> t = -pi:0.1:pi;
>> r = ((sin(t).*sqrt(cos(t))).*(sin(t) + (7/5)).^(-1)) - 2*sin(t) + 2 ;
>> plot(r,t)
??? Error using ==> plot
Vectors must be the same lengths.

What's wrong with the above?

© Stack Overflow or respective owner

Related posts about matlab

Related posts about plot