Raksha
Raksha

Reputation: 1699

How to plot a thick spiral in MatLab?

I can plot a regular spiral with

w = 0.1;
SAU = 0.1;
r = 0:100;
Phi = 2*pi/w*(1-SAU)*r/500;

but how can I change my Phi so that the graph is of a spiral that has some specified thickness rather than just a thin line spiral? Like this (here several spirals are plotted together, by ignore that): enter image description here

Upvotes: 0

Views: 1384

Answers (1)

sco1
sco1

Reputation: 12214

Utilize the output of your polar call to address and change line properties. In this case we're interested in the LineWidth property.

w = 0.1;
SAU = 0.1;
r = 0:100;
Phi = 2*pi/w*(1-SAU)*r/500;
h.myplot = polar(Phi, r);
h.myplot.LineWidth = 8; % Adjust as necessary

This assumes you have R2014b or newer. If you have an older version, use set. See this blog post for more information.

Edit: Per your comment I guess you could do something like:

w = 0.1;
SAU = 0.1;
r = 0:100;
Phi = 2*pi/w*(1-SAU)*r/500;

width = 50;
polar(Phi, r, '-b')
hold on
for ii = 2:width
    polar(Phi + (ii*pi)/180, r, '-b');
end

For comparison: plot comparison

Upvotes: 2

Related Questions