
how to generate curve up to particular point?
1 回表示 (過去 30 日間)
古いコメントを表示
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.

0 件のコメント
回答 (1 件)
Star Strider
2018 年 11 月 16 日
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 件のコメント
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 Center および File Exchange で Fit Postprocessing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
