How to draw a curve on a polar plot

조회 수: 7 (최근 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