"InterX" gives me TWO coordinates instead of ONE. How can I solve this?

1 visualización (últimos 30 días)
I execute this code in the command window:
hold on
grid
axis equal
Q=11;
x1=0;
y1=0;
R=10;
%% %DIBUJO DE LA CIRCUNFERENCIA
%x and y are the coordinates of the center of the circle
%r is the radius of the circle
%0.01 is the angle step, bigger values will draw the circle faster but
caca=2*pi();
ang=linspace(0,caca);
xp=R*cos(ang);
yp=R*sin(ang);
circ=[xp;yp];
plot(xp,yp,'r');
%% %DIBUJO DE LOS RAYOS
anguloo=0;
[r0x,r0y]=coordrecta(x1,y1,Q,anguloo)
r0=[x1 r0x;y1 r0y];
plot(r0(1,:),r0(2,:),'r')
anguloo=10;
[r10x,r10y]=coordrecta(x1,y1,Q,anguloo)
r10=[x1 r10x;y1 r10y];
plot(r10(1,:),r10(2,:),'r')
anguloo=20;
[r20x,r20y]=coordrecta(x1,y1,Q,anguloo)
r20=[x1 r20x;y1 r20y];
plot(r20(1,:),r20(2,:),'r')
anguloo=30;
[r30x,r30y]=coordrecta(x1,y1,Q,anguloo)
r30=[x1 r30x;y1 r30y];
plot(r30(1,:),r30(2,:),'r')
anguloo=40;
[r40x,r40y]=coordrecta(x1,y1,Q,anguloo)
r40=[x1 r40x;y1 r40y];
plot(r40(1,:),r40(2,:),'r')
anguloo=50;
[r50x,r50y]=coordrecta(x1,y1,Q,anguloo)
r50=[x1 r50x;y1 r50y];
plot(r50(1,:),r50(2,:),'r')
anguloo=60;
[r60x,r60y]=coordrecta(x1,y1,Q,anguloo)
r60=[x1 r60x;y1 r60y];
plot(r60(1,:),r60(2,:),'r')
anguloo=70;
[r70x,r70y]=coordrecta(x1,y1,Q,anguloo)
r70=[x1 r70x;y1 r70y];
plot(r70(1,:),r70(2,:),'r')
anguloo=80;
[r80x,r80y]=coordrecta(x1,y1,Q,anguloo)
r80=[x1 r80x;y1 r80y];
plot(r80(1,:),r80(2,:),'r')
anguloo=90;
[r90x,r90y]=coordrecta(x1,y1,Q,anguloo)
r90=[x1 r90x;y1 r90y];
plot(r90(1,:),r90(2,:),'r')
%% %PUNTOS DE CORTE C
c0=InterX(circ,r0);
plot(c0(1,:),c0(2,:),'go');
c10=InterX(circ,r10);
plot(c10(1,:),c10(2,:),'go');
c20=InterX(circ,r20);
plot(c20(1,:),c20(2,:),'go');
c30=InterX(circ,r30);
plot(c30(1,:),c30(2,:),'go');
c40=InterX(circ,r40);
plot(c40(1,:),c40(2,:),'go');
c50=InterX(circ,r50);
plot(c50(1,:),c50(2,:),'go');
c60=InterX(circ,r60);
plot(c60(1,:),c60(2,:),'go');
c70=InterX(circ,r70);
plot(c70(1,:),c70(2,:),'go');
c80=InterX(circ,r80);
plot(c80(1,:),c80(2,:),'go');
c90=InterX(circ,r90);
plot(c90(1,:),c90(2,:),'go');
%% %DIBUJO DE LAS TANGENTES
angulito=0+90;
[t0x2,t0y2]=coordrecta(c0(1),c0(2),3*R,angulito)
t0=[c0(1) t0x2;c0(2) t0y2];
plot(t0(1,:),t0(2,:),'b')
angulito=10+90;
[t10x2,t10y2]=coordrecta(c10(1),c10(2),3*R,angulito)
t10=[c10(1) t10x2;c10(2) t10y2];
plot(t10(1,:),t10(2,:),'b');
angulito=20+90;
[t20x2,t20y2]=coordrecta(c20(1),c20(2),3*R,angulito)
t20=[c20(1) t20x2;c20(2) t20y2];
plot(t20(1,:),t20(2,:),'b')
angulito=30+90;
[t30x2,t30y2]=coordrecta(c30(1),c30(2),3*R,angulito)
t30=[c30(1) t30x2;c30(2) t30y2];
plot(t30(1,:),t30(2,:),'b')
angulito=40+90;
[t40x2,t40y2]=coordrecta(c40(1),c40(2),3*R,angulito)
t40=[c40(1) t40x2;c40(2) t40y2];
plot(t40(1,:),t40(2,:),'b')
angulito=50+90;
[t50x2,t50y2]=coordrecta(c50(1),c50(2),3*R,angulito)
t50=[c50(1) t50x2;c50(2) t50y2];
plot(t50(1,:),t50(2,:),'b')
angulito=60+90;
[t60x2,t60y2]=coordrecta(c60(1),c60(2),3*R,angulito)
t60=[c60(1) t60x2;c60(2) t60y2];
plot(t60(1,:),t60(2,:),'b')
angulito=70+90;
[t70x2,t70y2]=coordrecta(c70(1),c70(2),3*R,angulito)
t70=[c70(1) t70x2;c70(2) t70y2];
plot(t70(1,:),t70(2,:),'b')
angulito=80+90;
[t80x2,t80y2]=coordrecta(c80(1),c80(2),3*R,angulito)
t80=[c80(1) t80x2;c80(2) t80y2];
plot(t80(1,:),t80(2,:),'b')
angulito=90+90;
[t90x2,t90y2]=coordrecta(c90(1),c90(2),3*R,angulito)
t90=[c90(1) t90x2;c90(2) t90y2];
plot(t90(1,:),t90(2,:),'b')
%% %DIBUJO DE LOS ARCOS
mierda=2*pi();
gulo=linspace(0,mierda);
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c80 (NO DIBUJARLO)
radius=norm(c90-c80);
zentroa=c80;
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i90
%i90=InterX(circulu,t90);
%plot(i90(1,:),i90(2,:),'bo');
i90=c90;
%calculo del punto de interseccion i80
i80=InterX(circulu,t80);
plot(i80(1,:),i80(2,:),'bo');
%recta i80-c80 recta inicio arco
recti=[c80(1) i80(1);c80(2) i80(2)];
%angulo inicio del arco, recta c80-i80
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i90-c80 recta inicio arco
rectf=[c80(1) i90(1);c80(2) i90(2)];
%angulo final del arco, recta c80-i90
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin);
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m');
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c70 (NO DIBUJARLO)
radius=norm(i80-c70);
zentroa=c70;
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i70
i70=InterX(circulu,t70);
plot(i70(1,:),i70(2,:),'bo');
And as you can see, the Intersec point i70 that Matlab gives me, is a 2x2 matrix. Thtat doesn't make any sense, because i70 is a point, it should be only a 2x1 matrix, with only one coordinates.
However, if I execute in the command window the same code, but the only code needed to calculate i70 replacing all de data (such as c70...etc) by its exact values, as I do here:
mierda=2*pi();
gulo=linspace(0,mierda);
t70=[3.4189 -24.7719;9.3934 19.6540];
radius=3.4814;
zentroa=[3.4189;9.3934]; %c70=[3.4189;9.3934]
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
i70=InterX(circulu,t70); %i70=[0.1475;10.5841]
Matlab gives me i70 as a 2x1 matrix, this is, the correct way of giving me the coordinates of a point:
If theorically is the same data, the same code, why does this happen? How can I solve it?
  2 comentarios
KSSV
KSSV el 28 de Oct. de 2020
If you see the 2*2 matrix displays the same values....you can pcik only one using unique.
iwant = unique(i70','rows')'
ErikJon Pérez Mardaras
ErikJon Pérez Mardaras el 28 de Oct. de 2020
Editada: ErikJon Pérez Mardaras el 28 de Oct. de 2020
I know, but the point is, why all "i" intersec points that Matlab calculates (i80,i60,i50,i40,i30...) are well calculated as a 2x1 matrix except "i70"? Why only i70 is bad calculated as a 2x2 matrix?
May sound like a stupid question but is a vital question for the further code I am programming. Here is the full code:
%DIBUJO DE LA EVOLVENTE
hold on
grid
axis equal
Q=11;
x1=0;
y1=0;
R=10;
%% %DIBUJO DE LA CIRCUNFERENCIA
%x and y are the coordinates of the center of the circle
%r is the radius of the circle
%0.01 is the angle step, bigger values will draw the circle faster but
caca=2*pi();
ang=linspace(0,caca);
xp=R*cos(ang);
yp=R*sin(ang);
circ=[xp;yp];
plot(xp,yp,'r');
%% %DIBUJO DE LOS RAYOS
anguloo=0;
[r0x,r0y]=coordrecta(x1,y1,Q,anguloo)
r0=[x1 r0x;y1 r0y];
plot(r0(1,:),r0(2,:),'r')
anguloo=10;
[r10x,r10y]=coordrecta(x1,y1,Q,anguloo)
r10=[x1 r10x;y1 r10y];
plot(r10(1,:),r10(2,:),'r')
anguloo=20;
[r20x,r20y]=coordrecta(x1,y1,Q,anguloo)
r20=[x1 r20x;y1 r20y];
plot(r20(1,:),r20(2,:),'r')
anguloo=30;
[r30x,r30y]=coordrecta(x1,y1,Q,anguloo)
r30=[x1 r30x;y1 r30y];
plot(r30(1,:),r30(2,:),'r')
anguloo=40;
[r40x,r40y]=coordrecta(x1,y1,Q,anguloo)
r40=[x1 r40x;y1 r40y];
plot(r40(1,:),r40(2,:),'r')
anguloo=50;
[r50x,r50y]=coordrecta(x1,y1,Q,anguloo)
r50=[x1 r50x;y1 r50y];
plot(r50(1,:),r50(2,:),'r')
anguloo=60;
[r60x,r60y]=coordrecta(x1,y1,Q,anguloo)
r60=[x1 r60x;y1 r60y];
plot(r60(1,:),r60(2,:),'r')
anguloo=70;
[r70x,r70y]=coordrecta(x1,y1,Q,anguloo)
r70=[x1 r70x;y1 r70y];
plot(r70(1,:),r70(2,:),'r')
anguloo=80;
[r80x,r80y]=coordrecta(x1,y1,Q,anguloo)
r80=[x1 r80x;y1 r80y];
plot(r80(1,:),r80(2,:),'r')
anguloo=90;
[r90x,r90y]=coordrecta(x1,y1,Q,anguloo)
r90=[x1 r90x;y1 r90y];
plot(r90(1,:),r90(2,:),'r')
%% %PUNTOS DE CORTE C
c0=InterX(circ,r0);
plot(c0(1,:),c0(2,:),'go');
c10=InterX(circ,r10);
plot(c10(1,:),c10(2,:),'go');
c20=InterX(circ,r20);
plot(c20(1,:),c20(2,:),'go');
c30=InterX(circ,r30);
plot(c30(1,:),c30(2,:),'go');
c40=InterX(circ,r40);
plot(c40(1,:),c40(2,:),'go');
c50=InterX(circ,r50);
plot(c50(1,:),c50(2,:),'go');
c60=InterX(circ,r60);
plot(c60(1,:),c60(2,:),'go');
c70=InterX(circ,r70);
plot(c70(1,:),c70(2,:),'go');
c80=InterX(circ,r80);
plot(c80(1,:),c80(2,:),'go');
c90=InterX(circ,r90);
plot(c90(1,:),c90(2,:),'go');
%% %DIBUJO DE LAS TANGENTES
angulito=0+90;
[t0x2,t0y2]=coordrecta(c0(1),c0(2),3*R,angulito)
t0=[c0(1) t0x2;c0(2) t0y2];
plot(t0(1,:),t0(2,:),'b')
angulito=10+90;
[t10x2,t10y2]=coordrecta(c10(1),c10(2),3*R,angulito)
t10=[c10(1) t10x2;c10(2) t10y2];
plot(t10(1,:),t10(2,:),'b');
angulito=20+90;
[t20x2,t20y2]=coordrecta(c20(1),c20(2),3*R,angulito)
t20=[c20(1) t20x2;c20(2) t20y2];
plot(t20(1,:),t20(2,:),'b')
angulito=30+90;
[t30x2,t30y2]=coordrecta(c30(1),c30(2),3*R,angulito)
t30=[c30(1) t30x2;c30(2) t30y2];
plot(t30(1,:),t30(2,:),'b')
angulito=40+90;
[t40x2,t40y2]=coordrecta(c40(1),c40(2),3*R,angulito)
t40=[c40(1) t40x2;c40(2) t40y2];
plot(t40(1,:),t40(2,:),'b')
angulito=50+90;
[t50x2,t50y2]=coordrecta(c50(1),c50(2),3*R,angulito)
t50=[c50(1) t50x2;c50(2) t50y2];
plot(t50(1,:),t50(2,:),'b')
angulito=60+90;
[t60x2,t60y2]=coordrecta(c60(1),c60(2),3*R,angulito)
t60=[c60(1) t60x2;c60(2) t60y2];
plot(t60(1,:),t60(2,:),'b')
angulito=70+90;
[t70x2,t70y2]=coordrecta(c70(1),c70(2),3*R,angulito)
t70=[c70(1) t70x2;c70(2) t70y2];
plot(t70(1,:),t70(2,:),'b')
angulito=80+90;
[t80x2,t80y2]=coordrecta(c80(1),c80(2),3*R,angulito)
t80=[c80(1) t80x2;c80(2) t80y2];
plot(t80(1,:),t80(2,:),'b')
angulito=90+90;
[t90x2,t90y2]=coordrecta(c90(1),c90(2),3*R,angulito)
t90=[c90(1) t90x2;c90(2) t90y2];
plot(t90(1,:),t90(2,:),'b')
%% %DIBUJO DE LOS ARCOS
mierda=2*pi();
gulo=linspace(0,mierda);
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c80 (NO DIBUJARLO)
radius=norm(c90-c80);
zentroa=c80;
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i90
%i90=InterX(circulu,t90);
%plot(i90(1,:),i90(2,:),'bo');
i90=c90;
%calculo del punto de interseccion i80
i80=InterX(circulu,t80);
plot(i80(1,:),i80(2,:),'bo');
%recta i80-c80 recta inicio arco
recti=[c80(1) i80(1);c80(2) i80(2)];
%angulo inicio del arco, recta c80-i80
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i90-c80 recta inicio arco
rectf=[c80(1) i90(1);c80(2) i90(2)];
%angulo final del arco, recta c80-i90
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin);
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m');
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c70 (NO DIBUJARLO)
radius=norm(i80-c70);
zentroa=c70;
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i70 %iX
i70=InterX(circulu,t70); %iX tX
plot(i70(1,:),i70(2,:),'bo'); %iX iX
%calculo del punto de interseccion i80 %iX+10 ya conocido
%i80=InterX(circulu,t80); %ix+10 tX+10
%plot(i80(1,:),i80(2,:),'bo'); %iX+10 iX+10
%recta i70-c70 recta inicio arco %iX-CX
recti=[c70(1) i70(1);c70(2) i70(2)];
%angulo inicio del arco, recta i70-C70 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i80-c70 recta fin del arco %iX+10 CX
rectf=[c70(1) i80(1);c70(2) i80(2)]; %CX iX+10
%angulo final del arco, recta i80-C70 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c60 (NO DIBUJARLO) % circulo en CX
radius=norm(i70-c60); % iX+10 - CX
zentroa=c60; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i60 %iX
i60=InterX(circulu,t60); %iX tX
plot(i60(1,:),i60(2,:),'bo'); %iX iX
%calculo del punto de interseccion i70 %iX+10 ya conocido
%i70=InterX(circulu,t70); %ix+10 tX+10
%plot(i70(1,:),i70(2,:),'bo'); %iX+10 iX+10
%recta i60-c60 recta inicio arco %iX-CX
recti=[c60(1) i60(1);c60(2) i60(2)];
%angulo inicio del arco, recta i60-C60 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i70-c60 recta fin del arco %iX+10 CX
rectf=[c60(1) i70(1);c60(2) i70(2)]; %CX iX+10
%angulo final del arco, recta i70-C60 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c50 (NO DIBUJARLO) % circulo en CX
radius=norm(i60-c50); % iX+10 - CX
zentroa=c50; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i50 %iX
i50=InterX(circulu,t50); %iX tX
plot(i50(1,:),i50(2,:),'bo'); %iX iX
%calculo del punto de interseccion i60 %iX+10 ya conocido
%i60=InterX(circulu,t70); %ix+10 tX+10
%plot(i60(1,:),i60(2,:),'bo'); %iX+10 iX+10
%recta i50-c50 recta inicio arco %iX-CX
recti=[c50(1) i50(1);c50(2) i50(2)];
%angulo inicio del arco, recta i50-C50 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i60-c50 recta fin del arco %iX+10 CX
rectf=[c50(1) i60(1);c50(2) i60(2)]; %CX iX+10
%angulo final del arco, recta i60-C50 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c40 (NO DIBUJARLO) % circulo en CX
radius=norm(i50-c40); % iX+10 - CX
zentroa=c40; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i40 %iX
i40=InterX(circulu,t40); %iX tX
plot(i40(1,:),i40(2,:),'bo'); %iX iX
%calculo del punto de interseccion i50 %iX+10 ya conocido
%i50=InterX(circulu,t50); %ix+10 tX+10
%plot(i50(1,:),i50(2,:),'bo'); %iX+10 iX+10
%recta i40-c40 recta inicio arco %iX-CX
recti=[c40(1) i40(1);c40(2) i40(2)];
%angulo inicio del arco, recta i40-C40 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i50-c40 recta fin del arco %iX+10 CX
rectf=[c40(1) i50(1);c40(2) i50(2)]; %CX iX+10
%angulo final del arco, recta i50-C40 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c30 (NO DIBUJARLO) % circulo en CX
radius=norm(i40-c30); % iX+10 - CX
zentroa=c30; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i30 %iX
i30=InterX(circulu,t30); %iX tX
plot(i30(1,:),i30(2,:),'bo'); %iX iX
%calculo del punto de interseccion i40 %iX+10 ya conocido
%i40=InterX(circulu,t40); %ix+10 tX+10
%plot(i40(1,:),i40(2,:),'bo'); %iX+10 iX+10
%recta i30-c30 recta inicio arco %iX-CX
recti=[c30(1) i30(1);c30(2) i30(2)];
%angulo inicio del arco, recta i30-C30 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i40-c30 recta fin del arco %iX+10 CX
rectf=[c30(1) i40(1);c30(2) i40(2)]; %CX iX+10
%angulo final del arco, recta i40-C30 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c20 (NO DIBUJARLO) % circulo en CX
radius=norm(i30-c20); % iX+10 - CX
zentroa=c20; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i20 %iX
i20=InterX(circulu,t20); %iX tX
plot(i20(1,:),i20(2,:),'bo'); %iX iX
%calculo del punto de interseccion i30 %iX+10 ya conocido
%i30=InterX(circulu,t30); %ix+10 tX+10
%plot(i30(1,:),i30(2,:),'bo'); %iX+10 iX+10
%recta i20-c20 recta inicio arco %iX-CX
recti=[c20(1) i20(1);c20(2) i20(2)];
%angulo inicio del arco, recta i20-C20 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i30-c20 recta fin del arco %iX+10 CX
rectf=[c20(1) i30(1);c20(2) i30(2)]; %CX iX+10
%angulo final del arco, recta i30-C20 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c10 (NO DIBUJARLO) % circulo en CX
radius=norm(i20-c10); % iX+10 - CX
zentroa=c10; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i10 %iX
i10=InterX(circulu,t10); %iX tX
plot(i10(1,:),i10(2,:),'bo'); %iX iX
%calculo del punto de interseccion i20 %iX+10 ya conocido
%i20=InterX(circulu,t20); %ix+10 tX+10
%plot(i20(1,:),i20(2,:),'bo'); %iX+10 iX+10
%recta i10-c10 recta inicio arco %iX-CX
recti=[c10(1) i10(1);c10(2) i10(2)];
%angulo inicio del arco, recta i10-C10 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i20-c10 recta fin del arco %iX+10 CX
rectf=[c10(1) i20(1);c10(2) i20(2)]; %CX iX+10
%angulo final del arco, recta i20-C10 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
% con CADA punto/arco %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%circulo en c0 (NO DIBUJARLO) % circulo en CX
radius=norm(i10-c0); % iX+10 - CX
zentroa=c0; %CX
corx=zentroa(1)+radius*cos(gulo);
cory=zentroa(2)+radius*sin(gulo);
circulu=[corx;cory];
%calculo del punto de interseccion i0 %iX
i0=InterX(circulu,t0); %iX tX
plot(i0(1,:),i0(2,:),'bo'); %iX iX
%calculo del punto de interseccion i10 %iX+10 ya conocido
%i10=InterX(circulu,t10); %ix+10 tX+10
%plot(i10(1,:),i10(2,:),'bo'); %iX+10 iX+10
%recta i0-c0 recta inicio arco %iX-CX
recti=[c0(1) i0(1);c0(2) i0(2)];
%angulo inicio del arco, recta i0-C0 %iX-CX
[angini]=angulodrectav2(recti)
%pasandolo a radianes
rangini=deg2rad(angini);
%recta i10-c0 recta fin del arco %iX+10 CX
rectf=[c0(1) i10(1);c0(2) i10(2)]; %CX iX+10
%angulo final del arco, recta i10-C0 %iX+10 CX
[angfin]=angulodrectav2(rectf)
%pasandolo a radianes
rangfin=deg2rad(angfin);
%dibujo del arco
teta = linspace(rangini,rangfin); %es el recorrido de angulo que va a tener, esto es, desde el angulo a hasta el b. PONERLO EN RADIANES
xco = zentroa(1)+radius*cos(teta);
yco = zentroa(2)+radius*sin(teta);
plot(xco,yco,'m') %dibujarlo en magenta 'm'
As you can check, all "i" intersec points are well calculated by matlab (as a logic 2x1 matrix corresponding to the x and y coordinates) except of i70.
I don't know why and I would like to know what does it happen if calculated the same way as others

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Geology en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by