Funny problem. What is cos(pi/2) in matlab?
While I was programming on matlab I encountered something funny. I don't know if its a bug or what.
Now we all know that cos(pi/2) should be 0. Right??
Now do this:
run this, you should get that outcome:
a = 55;
theta = pi/2;
P = [a1*cos(theta); a1*sin(theta)]
Now here is the messed up part: Input this line now:
P(1) %to get the value of first row
And here is the answer
See it here:
>> a = 55
>> theta = pi/2
>> P = [a1*cos(theta); a1*sin(theta)]
Why the heck is this happening?? what am I doing wrong??
Please try it on your own matlab. I am using Matlab 7.9 (R2009b)
This should be the simplest code in matlab.