Linspace and polar coordinates
이전 댓글 표시
Hello.
I'm a little lost when it comes to using polar coordinates in matlab. How would I set up a linspace for polar coordinates? I'm also unsure of what the best method is for plotting in polar, should I use the polar command?
I've been using the code below but keep recieving an error.
x=[-2 -1 0 1 2];
y=[-2 -1 0 1 2];
%cartesian --> polar
rho=sqrt(x.^2+y.^2);
theta=atan(y./x);
%set up linspace with 10 pts
rho2=linspace(rho,rho,10) %this is where I'm confused because I don't know how to apply the conversion into linspace
theta2=linspace(theta,theta,10)
%eqns
for x=1:length(rho)
for z=1:length(theta)
u(x,z)=sin(2*theta(z)).*cos(2*theta(z));
end
end
%plot
polarplot(rho2,theta2,u) %error here too?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!