问题
As title
I only have the theta/rho data
the line equation is
x*cos(theta)+y*sin(theta)=rho
how to plot line whith these data in matlab?
are there any function which input are theta and rho?
thanks
回答1:
Just use some simple Algebra to find out how y is related to x.
Take some range for x:
x = -10:10;
y = (rho - x* cos(theta) )/ sin(theta);
plot(x,y)
回答2:
You can just use the built in polar function
polar(theta,rho) creates a polar coordinate plot of the angle theta versus the radius rho. theta is the angle from the x-axis to the radius vector specified in radians; rho is the length of the radius vector specified in dataspace units.
You can also transform polar to cartesian with pol2cart() then use the regular plot(x,y) function.
[X,Y] = pol2cart(THETA,RHO) transforms the polar coordinate data stored in corresponding elements of THETA and RHO to two-dimensional Cartesian, or xy, coordinates. The arrays THETA and RHO must be the same size (or either can be scalar). The values in THETA must be in radians.
There is also a cart2pol() function that does the reverse transformation.
[THETA,RHO] = cart2pol(X,Y) transforms two-dimensional Cartesian coordinates stored in corresponding elements of arrays X and Y into polar coordinates.
来源:https://stackoverflow.com/questions/8655745/how-to-plot-line-in-matlab-with-theta-rho-data