Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

Cartesian to Polar co-ordinates: matlab code


  To find the angle of a point in the Cartesian co-ordinates, convert the co-ordinates topolar co-ordinates using the function cart2pol(x,y) . The output will be radius and the angle. The radius is calculated from the origin to the given point. The theta value will be in radians. The function rad2deg(theta) can be used to convert the radians to degree.

MATLAB CODE:
I am using this plot function to display the points in the Cartesian co-ordinates.
plot([-10 -3 10 0 0 0 0 0 2 ] ,[0 0  0 0 6 10 -10 0 3],'--rs','LineWidth',2,'MarkerFaceColor','k');
%180 degrees
[theta,radius]=cart2pol(-2,0);
deg=rad2deg(theta);

%display the radius , angle and the co-ordinates in the axes.

degree=strcat('deg:',num2str(deg));
rad=strcat('radius:',num2str(radius));
text(-3,-2,degree);
text(-3,-3,rad);
           
%90 degrees
[theta,radius]=cart2pol(0,6);
deg=rad2deg(theta);

degree=strcat('deg:',num2str(deg));
rad=strcat('radius:',num2str(radius));
text(-3,6,degree);
text(-3,5,rad);

%45 degrees
[theta,radius]=cart2pol(2,2);
deg=rad2deg(theta);

degree=strcat('deg:',num2str(deg));
rad=strcat('radius:',num2str(radius));
text(4,3,degree);
text(4,2,rad);

0 comments:

Post a Comment

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.