Polar plot 0-180 degree with given data
32 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Saulius Janusauskas
il 16 Ago 2018
Commentato: Saulius Janusauskas
il 16 Ago 2018
Hey guys,
I need to generate polar coordinates and create this 'sensor beam' that would cover 0 to 180 degrees by 5 degree increase with values varying of (0.0x to 0.x). which means there is ~37 values.
6 Commenti
Rik
il 16 Ago 2018
You should provide a clear description of your inputs and the intended output. My code shows you how to have 5 degree jumps. How doesn't that work for you? What code are you trying to apply it to your data? What errors are you getting?
Risposta accettata
Rik
il 16 Ago 2018
Today's lesson: never assume, but RTM. Because you mentioned 180 degrees, I assumed you had checked the doc to see if Matlab uses radians of degrees. I also assumed that my code would work, as it was only a 3 line example.
It turns out both assumptions were incorrect. The polarplot function uses radian, so my code example actually inputs 28.6 revolutions instead of 180 degrees. You can fix this by using the deg2rad function (which avoids typos), or use a manual conversion factor (so deg*pi/180).
This code should actually do what you mean.
rho=rand(size(theta))/10;
theta=0:5:180;%or theta=linspace(0,180,numel(rho));
figure(1),clf(1)
polarplot(deg2rad(theta),rho)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Polar Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!