MATLAB Answers

How to draw a curve on a polar plot

15 views (last 30 days)
Flo brd
Flo brd on 20 Nov 2018
Answered: Flo brd on 21 Nov 2018
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, '-');
  1 Comment
Flo brd
Flo brd on 21 Nov 2018
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);

Sign in to comment.

Answers (1)

Flo brd
Flo brd on 21 Nov 2018
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-');
Thank you

Community Treasure Hunt

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

Start Hunting!