Polarplot plotting a single point not a line
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Robert
am 2 Dez. 2016
Beantwortet: Steven Lord
am 2 Dez. 2016
Just like it says
Polarplot is plotting only a single point when the doc clearly says it plots a line out from some theta and some rho
why?
rho = 5
theta = 120*(pi/180)
polarplot(theater,rho)
I have also tried this
rho = 0:.01:5;
theta = 120
polarplot(theta,rho(:)):
Also no go
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 2 Dez. 2016
In your first case, you've given it one value for rho and one for theta. [I'm assuming the "theater" on the third line is a typo.] Since you only give the coordinates of one point to polarplot, it only plots one point.
As written your second case creates length(rho) individual lines, each of which represents one data point. The first is theta = 120, rho = 0. You can confirm this by adding a marker.
polarplot(theta, rho, 'o');
If you want to connect all those points with a line, repmat the scalar theta so it is a vector the same size as rho. That will create one line containing all the data.
thetaV = repmat(theta, size(rho));
polarplot(thetaV, rho);
One more thing to note is from the polarplot documentation. The theta input should contain "Angle values, specified as a vector or matrix. Specify the values in radians. To convert data from degrees to radians, use deg2rad." You look like you're specifying theta using degrees not radians.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Resizing and Reshaping Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!