当前位置:网站首页>Matlab | visualization of mathematical properties related to three interesting circles
Matlab | visualization of mathematical properties related to three interesting circles
2022-06-27 03:48:00 【slandarer】
Quasi circle of ellipse

proposition 1: A point outside the ellipse makes two tangents to the ellipse , If two tangents are perpendicular , Then the locus of the point is a circle .
Simply explain why :
For ellipses x 2 a 2 + y 2 b 2 = 1 \frac{x^2}{a^2}+\frac{y^2}{b^2}=1 a2x2+b2y2=1, Assume its fault ( m , n ) (m,n) (m,n) The tangent equation of the point is y − n = k ( x − m ) y-n=k(x-m) y−n=k(x−m), Bring in the elliptic equation :
b 2 x 2 + a 2 ( k 2 ( x − m ) 2 + 2 n k ( x − m ) + n 2 ) − x 2 b 2 = 0 ( a 2 k 2 + b 2 ) x 2 + 2 k a 2 ( n − m k ) x + a 2 ( k m − n ) 2 − a 2 b 2 = 0 \begin{aligned} &b^2x^2+a^2(k^2(x-m)^2+2nk(x-m)+n^2)-x^2b^2=0\\ &(a^2k^2+b^2)x^2+2ka^2(n-mk)x+a^2(km-n)^2-a^2b^2=0 \end{aligned} b2x2+a2(k2(x−m)2+2nk(x−m)+n2)−x2b2=0(a2k2+b2)x2+2ka2(n−mk)x+a2(km−n)2−a2b2=0
Because it is a tangent, so Δ = 0 \Delta=0 Δ=0, namely ( m 2 − a 2 ) k 2 − 2 m n k + n 2 − b 2 (m^2-a^2)k^2-2mnk+n^2-b^2 (m2−a2)k2−2mnk+n2−b2, This is one about k k k Constraints of , The slopes of the two tangents are obtained from the Weida theorem k 1 , k 2 k_1,k_2 k1,k2 Meet the conditions :
k 1 k 2 = n 2 − b 2 m 2 − a 2 k_1k_2=\frac{n^2-b^2}{m^2-a^2} k1k2=m2−a2n2−b2
Because the two tangents are perpendicular , therefore k 1 k 2 = − 1 k_1k_2=-1 k1k2=−1, So there is :
m 2 + n 2 = a 2 + b 2 m^2+n^2=a^2+b^2 m2+n2=a2+b2
It's a radius of a 2 + b 2 \sqrt{a^2+b^2} a2+b2 The circle of .
Visualization :
MATLAB Code :
function directorC
% @author : slandarer
% official account : slandarer essays
% You know : hikari
a=3;b=2;syms k
% axes Basic property settings
ax=gca;
hold on;grid on
ax.XLim=[-6,6];
ax.YLim=[-4,4];
ax.DataAspectRatio=[1,1,1];
ax.XAxisLocation='origin';
ax.YAxisLocation='origin';
ax.LineWidth=1.5;
ax.XMinorTick='on';
ax.YMinorTick='on';
ax.GridLineStyle='-.';
ax.GridAlpha=.09;
% Draw circles and ellipses
t=linspace(0,2*pi,200);
plot(a.*cos(t),b.*sin(t),'LineWidth',2.5,'Color',[0,118,168]./255)
plot(sqrt(a^2+b^2).*cos(t),sqrt(a^2+b^2).*sin(t),'LineWidth',2.5,'Color',[169,64,71]./255)
% Draw tangents and intersections
thetaList=linspace(0,2*pi,200);
kline1=plot(0,0,'-.','LineWidth',1.5,'Color',[1,1,1].*.5);
kline2=plot(0,0,'-.','LineWidth',1.5,'Color',[1,1,1].*.5);
kpnt=scatter(a,0,'filled','CData',[1,1,1].*.3);
X=-6:.1:6;
% Circular drawing
for i=1:length(thetaList)
theta=thetaList(i);
m=sqrt(a^2+b^2).*cos(theta);
n=sqrt(a^2+b^2).*sin(theta);
kk=double(solve((m^2-a^2)*k^2-2*m*n*k+n^2-b^2==0));
Y1=kk(1).*(X-m)+n;Y2=kk(2).*(X-m)+n;
kline1.XData=X;kline1.YData=Y1;
kline2.XData=X;kline2.YData=Y2;
kpnt.XData=m;
kpnt.YData=n;
drawnow;
pause(.01)
end
end
The illusion of rotation
proposition 2: Suppose there is a radius of r 2 \frac{r}{2} 2r The small circle of has a radius of r r r Roll in the big circle , The locus of points on a small circle is a straight line .
The proof is simple , Suppose there is a little contact between the small circle and the big circle , At this time, the line between the center of the small circle and the origin is x The included angle in the positive direction of the axis is θ 0 \theta_0 θ0, Now suppose that the rolling of the small circle causes the change of the included angle of the center of the small circle θ \theta θ, Because the radius of the small circle is half of that of the big circle , So when you roll the same way , The included angle of the points on the small circle changes in the opposite direction 2 θ 2\theta 2θ Therefore, the parameter equation of the position change of the point on the small circle can be obtained :
{ x = r 2 c o s ( θ 0 + θ ) + r 2 c o s ( θ 0 + θ − 2 θ ) y = r 2 s i n ( θ 0 + θ ) + r 2 s i n ( θ 0 + θ − 2 θ ) ⇒ { x = ( r 2 c o s ( θ ) ) c o s ( θ 0 ) y = ( r 2 c o s ( θ ) ) s i n ( θ 0 ) \begin{aligned} &\left\{\begin{matrix} x=\frac{r}{2}cos(\theta_0+\theta)+\frac{r}{2}cos(\theta_0+\theta-2\theta)\\ y=\frac{r}{2}sin(\theta_0+\theta)+\frac{r}{2}sin(\theta_0+\theta-2\theta)\\ \end{matrix}\right. \\ \Rightarrow &\left\{\begin{matrix} x=(\frac{r}{2}cos(\theta))cos(\theta_0)\\ y=(\frac{r}{2}cos(\theta))sin(\theta_0) \end{matrix}\right. \end{aligned} ⇒{ x=2rcos(θ0+θ)+2rcos(θ0+θ−2θ)y=2rsin(θ0+θ)+2rsin(θ0+θ−2θ){ x=(2rcos(θ))cos(θ0)y=(2rcos(θ))sin(θ0)
This is a cross origin , The angle is θ 0 \theta_0 θ0 Straight line , The proof is complete , All points on the small circle go straight , For visualization to look good , Here, draw several equal points to make some visualization :
Visualization :

MATLAB Code :
function PointOnLineInCircle(N)
% @author : slandarer
% official account : slandarer essays
% You know : hikari
if nargin<1||N<2
N=4;
end
% 0.2157 0.3765 0.5725
% 0.3098 0.5059 0.7412
% figure And axes Basic property settings
fig=gcf;
fig.Name='PoLiC';
fig.Position=[50 100 600 600];
fig.NumberTitle='off';
fig.MenuBar='none';
%
ax=axes(fig);
ax.Position=[0 0 1 1];
ax.XLim=[-2.05 2.05];
ax.YLim=[-2.05 2.05];
ax.XColor='none';
ax.YColor='none';
hold(ax,'on');
% grid on
thetaB=0;
thetaS=0;
% Draw a straight line
pntsTheta=0:2*pi/N:2*pi;
for i=1:(length(pntsTheta)-1)
plot([cos(pntsTheta(i)),cos(pntsTheta(i)+pi)].*2,...
[sin(pntsTheta(i)),sin(pntsTheta(i)+pi)].*2,...
'Color',[0.8 0.8 0.8],'LineWidth',1.5)
end
if mod(N,2)==0
for i=1:(length(pntsTheta)-1)
plot([cos(pntsTheta(i)+2*pi/N/2),cos(pntsTheta(i)+2*pi/N/2+pi)].*2,...
[sin(pntsTheta(i)+2*pi/N/2),sin(pntsTheta(i)+2*pi/N/2+pi)].*2,...
'Color',[0.8 0.8 0.8],'LineWidth',1.5)
end
end
% Draw a big circle
tempT=0:0.1:2*pi+0.1;
CPnts=[cos(tempT);sin(tempT)];
plot(CPnts(1,:).*2,CPnts(2,:).*2,'Color',[0.2098 0.4059 0.6412],'LineWidth',2);
% Draw a small circle
sCircleHdl=plot(cos(thetaB)+CPnts(1,:),sin(thetaB)+CPnts(2,:),...
'Color',[0.3098 0.5059 0.7412],'LineWidth',2);
% Draw a positive inscribed polygon
pntsHdl=plot(cos(pntsTheta+thetaS)+cos(thetaB),...
sin(pntsTheta+thetaS)+sin(thetaB),...
'Color',[0.2157 0.3765 0.5725],'LineWidth',2,'Marker','o',...
'MarkerFaceColor',[0 0 0],'MarkerEdgeColor',[0 0 0],'MarkerSize',6);
patchHdl=fill(cos(pntsTheta(1:end-1)+thetaS)+cos(thetaB),...
sin(pntsTheta(1:end-1)+thetaS)+sin(thetaB),...
[0.8500 0.3250 0.0980],'EdgeColor','none','FaceAlpha',0.1);
% Circular drawing
while 1
thetaB=thetaB-2*pi/200;
thetaS=thetaS+2*pi/200;
sCircleHdl.XData=cos(thetaB)+CPnts(1,:);
sCircleHdl.YData=sin(thetaB)+CPnts(2,:);
pntsHdl.XData=cos(pntsTheta+thetaS)+cos(thetaB);
pntsHdl.YData=sin(pntsTheta+thetaS)+sin(thetaB);
patchHdl.XData=cos(pntsTheta(1:end-1)+thetaS)+cos(thetaB);
patchHdl.YData=sin(pntsTheta(1:end-1)+thetaS)+sin(thetaB);
pause(0.05);
end
end
Lissajous figure
There's nothing to say about this , It's good to draw a good picture hiahiahia:
Visualization :
MATLAB Code :
function lissajous
% @author : slandarer
% official account : slandarer essays
% You know : hikari
% figure And axes Basic property settings
fig=gcf;
fig.Position([2,4])=...
[fig.Position(2)-fig.Position(3)+fig.Position(4),fig.Position(3)];
%
ax=gca;hold on
ax.Color=[102,117,149]./255;
ax.XColor='none';ax.XLim=[.4,8.6];ax.YTick=[];
ax.YColor='none';ax.YLim=[.4,8.6];ax.XTick=[];
ax.DataAspectRatio=[1,1,1];
ax.InnerPosition=[0,0,1,1];
% Draw circles
t=linspace(0,2*pi,200)';
X=cos(t).*0.42;Y=sin(t).*0.42;
plot(X+ones(1,7),Y+(1:7),'Color',[1,1,1,.7],'LineWidth',2);
plot(X+(2:8),Y+ones(1,7).*8,'Color',[1,1,1,.7],'LineWidth',2);
% Draw points and base lines
[Xpnt,Ypnt]=meshgrid(2:8,1:7);
pntHdl=plot(Xpnt+0.42,Ypnt,'Color',[1,1,1],'LineStyle','none',...
'Marker','o','MarkerFaceColor',[1,1,1]);
XlineCol=2:8;YlineCol=8.*ones(1,7);
XlineRow=ones(1,7);YlineRow=1:7;
lineColHdl=plot([XlineCol;Xpnt(1,:)]+0.42,[YlineCol;Ypnt(1,:)],...
'Color',[1,1,1,.5],'LineStyle','-.','Marker','o','MarkerFaceColor',[1,1,1]);
lineRowHdl=plot([XlineRow;Xpnt(:,end)']+0.42,[YlineRow;Ypnt(:,end)'],...
'Color',[1,1,1,.5],'LineStyle','-.','Marker','o','MarkerFaceColor',[1,1,1]);
% Draw polyline handle
for m=1:7
for n=1:7
lineMatHdl(m,n)=plot(Xpnt(n,m),Ypnt(n,m),...
'Color',[1,1,1,.6],'LineWidth',1.2);
end
end
ratio=1:7;
thetaList=linspace(0,2*pi,300);
% Circular drawing
for i=1:length(thetaList)
theta=thetaList(i).*ratio;
tX=cos(theta).*0.42;
tY=sin(theta).*0.42;
for j=1:7
pntHdl(j).XData=Xpnt(:,j)+tX(j);
pntHdl(j).YData=Ypnt(:,j)+tY(end:-1:1)';
lineColHdl(j).XData=[XlineCol(j);Xpnt(1,j)]+tX(j);
lineColHdl(j).YData=[YlineCol(j);Ypnt(1,j)]+[tY(j);tY(7)];
lineRowHdl(j).XData=[XlineRow(j);Xpnt(j,end)']+[tX(8-j);tX(7)];
lineRowHdl(j).YData=[YlineRow(j);Ypnt(j,end)']+tY(8-j);
end
%
ttList=thetaList(1:i);
for m=1:7
for n=1:7
lineMatHdl(m,n).XData=cos(ttList.*m).*0.42+Xpnt(n,m);
lineMatHdl(m,n).YData=sin(ttList.*(8-n)).*0.42+Ypnt(n,m);
end
end
drawnow
pause(.01)
end
end
边栏推荐
- 2016Analyzing the Behavior of Visual Question Answering Models
- Fplan layout
- Method of decoding iPhone certificate file
- 2021:AdaVQA: Overcoming Language Priors with Adapted Margin Cosine Loss∗自适应的边缘余弦损失解决语言先验
- IOS development: understanding of dynamic library shared cache (dyld)
- PAT甲级 1023 Have Fun with Numbers
- 苹果唯一图谱架构常识
- 2019LXMERT:Learning Cross-Modality Encoder Representations from Transformers
- 2021:Greedy Gradient Ensemble for Robust Visual Question Answering
- 如何让 EF Core 6 支持 DateOnly 类型
猜你喜欢

超級詳細,2 萬字詳解,吃透 ES!

为什么 C# 访问 null 字段会抛异常?

MATLAB | 三个趣的圆相关的数理性质可视化

jmeter分布式压测

2021:adavqa: overlapping language priors with adapted margin cosine loss *

【一起上水硕系列】Day 6

Uni-app 之uParse 富文本解析 完美解析富文本!

Ledrui ldr6035 usb-c interface device supports rechargeable OTG data transmission scheme.

Baidu PaddlePaddle's "universal gravitation" first stop in 2022 landed in Suzhou, comprehensively launching the SME empowerment plan

JMeter distributed pressure measurement
随机推荐
Method of decoding iPhone certificate file
Mysql database foundation: DQL data query language
乐得瑞LDR6035 USB-C接口设备支持可充电可OTG传输数据方案。
投资理财产品的钱有保障吗?会不会没有了?
基于MobileNet-Yolov4搭建轻量化目标检测
2021:Graphhopper: Multi-Hop Scene Graph Reasoning for Visual Question Answering
jmeter分布式压测
Pat grade a 1021 deep root
Basic functions of promise [IV. promise source code]
Network structure and model principle of convolutional neural network (CNN)
人群模拟
[Shangshui Shuo series] day 6
Argo Workflows —— Kubernetes的工作流引擎入门
Pat grade a 1020 tree Traversals
敏捷开发篇--Agile Development-自用
IDEA中好用的插件
Anaconda3安裝過程及安裝後缺失大量文件,沒有scripts等目錄
电商产品如何在知乎上进行推广和打广告?
ESP8266
fplan-布局