how to generate curve up to particular point?

조회 수: 2 (최근 30일)
MANALI DODIYA
MANALI DODIYA 2018년 11월 16일
댓글: Star Strider 2018년 11월 17일
I need to generate profile which is combination of multiple curves. I get intersecting point of different curve. I need to remove extra green curve after intersection point.Capture.JPG

답변 (1개)

Star Strider
Star Strider 2018년 11월 16일
Referring back to your previous Question (and thank you for Accepting it):
syms Rb
R1=200;
R3=100;
R2=(R1+R3)/2;
theta=135;
Rb=vpasolve((tan(acos(Rb/R1))-tan(acos(Rb/R2))-(acos(Rb/R1))+(Rb/R2))*(180/pi)==180-theta,Rb);
disp(Rb)
alpha=(tan(acos(Rb/R2))-acos(Rb/R2))*(180/pi);
% disp(alpha)
t=linspace(0,2*pi);
x1=Rb*(cos(t-alpha)+t.*sin(t-alpha));
y1=Rb*(sin(t-alpha)-t.*cos(t-alpha));
x2=R1*cos(t);
y2=R1*sin(t);
x1 = double(x1);
y1 = double(y1);
x2 = double(x2);
y2 = double(y2);
[in,on] = inpolygon(x1, y1, x2, y2); % Find (x1,y1) In Or On (x2,y2)
inon = in | on;
figure
plot(x1,y1, x2, y2)
hold on
hinon = plot(x1(inon),y1(inon), 'pg'); % (x1,y1) In Or On (x2,y2)
hout = plot(x1(~inon),y1(~inon), 'pm') % (x1,y1) Outside (x2,y2)
hold off
legend([hinon,hout], '(x1,y1) In | On (x2,y2)', '(x1,y1) Outside (x2,y2)', 'Location','SE')
I am not certain what you intend with ‘after intersection point’, so I included both options (inside and outside the ellipse), and displayed them with different-colored pentagrams.
  댓글 수: 2
MANALI DODIYA
MANALI DODIYA 2018년 11월 17일
Thank you so much for response. actually i need to generate profile. In your answer as per my profile no gap between curve but i keep getting gap between curve as shown in graph.Capture2.JPG
Star Strider
Star Strider 2018년 11월 17일
I cannot find a numeric or analytic expression to solve for the intersection that produces reasonable values for both functions, using solve or fsolve.
I would increase the resolution (here ‘N’) in the linspace call to get as close as you can:
N = 1E+5;
t = linspace(0,2*pi,N);
and then go with the smallest distance (as previously), or use Bruno Luong’s suggestion on the File Exchange contribution he cited in his Comment in your earlier Question.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by