How to draw a curve on a polar plot

8 次查看(过去 30 天)
Flo brd
Flo brd 2018-11-20
回答: Flo brd 2018-11-21
Hello everyone,
I am not familiar with polar and polarplot, but I guess I got that I needed a theta and a rho. What I can't figure yet is how to connect my 3 black dots appearing on the following picture, and by a nice curve. What I manage to get so far is that half-circle. The idea would be to connect both ends to the two blacks dots on the side of the stereonet, while the curve would get through the third dot.
Here is the piece of code I am using so far (I have to use polar(), I know it's passed but it's required for the moment)
strikeFault = 100; %deg
dipFault = 45; %deg
B = cos(deg2rad(dipFault))*radiusPlot; %[0 1]
polar(deg2rad(strikeFault),1,'kO'); %from here
hold on
polar(deg2rad(strikeFault+180),1, 'kO');%to there
hold on
polar((deg2rad((strikeFault +strikeFault +180)/2)), B, 'kO' );% dip
hold on
theta2 = linspace(deg2rad(strikeFault), deg2rad(strikeFault+180), 50); %# divide circle by N points (length of data)
r2 = B; %# radius
x = r2.*cos(theta2); %# x-coordinate
y = r2.*sin(theta2); %# y-coordinate
plot(x, y, '-');
Cheers,
Flo
  1 个评论
Flo brd
Flo brd 2018-11-21
I think I've found a way:
x = [deg2rad(strikeFault) deg2rad(strikeFault+180) deg2rad((strikeFault +strikeFault +180)/2)];
y = [1 1 B];
xi = linspace(deg2rad(strikeFault), deg2rad(strikeFault+180), 50);
yi=interp1(x,y,xi,'spline');
polar(xi,yi);

请先登录,再进行评论。

回答(1 个)

Flo brd
Flo brd 2018-11-21
Hi again people,
I've got the same question, but with a polarplot this time. As you can see on the picture, the curve of the line isn't quite right. I also attach my code:
polarplot([0 2*pi],[90 0]);
hold on
dipFault = 30;
x = [deg2rad(strikeFault) deg2rad((strikeFault +strikeFault +180)/2) deg2rad(strikeFault+180) ];
y = [90 dipFault 90];
x1 = linspace(deg2rad(strikeFault), deg2rad((strikeFault +180)));
y1 = interp1(x, y, x1, 'spline');
polarplot((x1), (y1), 'k-');
polar.png
Thank you

Community Treasure Hunt

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

Start Hunting!

Translated by