Filter löschen
Filter löschen

How to plot an hexagon or square spiral shape ?

11 Ansichten (letzte 30 Tage)
Zeinab Ahmadi93
Zeinab Ahmadi93 am 8 Jul. 2017
Beantwortet: darova am 14 Jun. 2020
Hello I am trying to plot an spiral shape similar to one of the following figures(There is no difference, I need one of them, plooting in simple(solid) line is enough for me, I don't need markers on them) but I have no idea how to do it in matlab. Thanks in advance.

Antworten (2)

darova
darova am 14 Jun. 2020
try ths
t = 0:pi/2:100;
r = t.^2/100;
[x,y] = pol2cart(t,r);
plot(x,y)
pi/2 pi/4

jonatan
jonatan am 8 Jul. 2017
It is best to be solved in polar coordinates. For a simple square, you can show the relationship:
theta = 0:0.01:2*pi;
rho = min(abs(sec(t)), abs(csc(t)));
So if you want to create a spiral, you will need a small adjustment:
N = 10; %Number of spirals
theta = 0:0.01:2*pi*N;
rho = min(abs(sec(t)), abs(csc(t))) * theta;
You now can plot it using polarplot or convert it to Cartesian coordinates and using the regular plot function.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by