Matlab - Unir matrices

 
Vista:
sin imagen de perfil

Unir matrices

Publicado por Cristian (4 intervenciones) el 08/08/2015 07:44:47
Hola a todos.
tengo el siguiente problema.
Estoy adaptando el comando polyxpoly de matlab a un problema que estoy resolviendo. El tema es que genero un par de matrices y no he podido unirlas. Este es lo que hice:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
clc;clear all
close all
lado=87 % ancho
axis([-20 100 -20 100]);
axis([-10,lado+10,-10,lado+10]);
grid
hold on
% Define and fill a rectangular area in the plane
xlimit = [0 lado];
ylimit = [0  lado];
xbox = xlimit([1 1 2 2 1])
ybox = ylimit([1 2 2 1 1])
mapshow(xbox,ybox,'DisplayType','polygon','LineStyle','none')
 
% Define and display a two-part polyline
r=9;
t=0:0.01:2.01*pi;
 
 
for i=1:3
 
    centro(1,1)=5
    centro(1,2)=3
 
    centro(2,1)=88
    centro(2,2)=3
 
    centro(3,1)=88
    centro(3,2)=50
 
 
 
    x = r*cos(t)+ centro(i,1);
    y = r*sin(t)+ centro(i,2);
    mapshow(x,y,'Marker','+')
    % Intersect the polyline with the rectangle
[x, y] = polyxpoly(x, y, xbox, ybox)
Inter=[x y]
 
mapshow(x,y,'DisplayType','point','Marker','x')
end

las matrices que debo unir son las Inter calculadas.
Espero me puedan ayudar.
Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Royeth
Val: 3.309
Plata
Ha mantenido su posición en Matlab (en relación al último mes)
Gráfica de Matlab

Unir matrices

Publicado por Royeth (1818 intervenciones) el 08/08/2015 18:53:22
bueno puedes hacer lo siguiente :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
clc;clear all
 
close all
 
Inter=[];
lado=87 % ancho
 
axis([-20 100 -20 100]);
 
axis([-10,lado+10,-10,lado+10]);
 
grid
 
hold on
 
% Define and fill a rectangular area in the plane
 
xlimit = [0 lado];
 
ylimit = [0  lado];
 
xbox = xlimit([1 1 2 2 1])
 
ybox = ylimit([1 2 2 1 1])
 
mapshow(xbox,ybox,'DisplayType','polygon','LineStyle','none')
 
 
 
% Define and display a two-part polyline
 
r=9;
 
t=0:0.01:2.01*pi;
 
 
 
 
 
for i=1:3
 
 
 
    centro(1,1)=5
 
    centro(1,2)=3
 
 
 
    centro(2,1)=88
 
    centro(2,2)=3
 
 
 
    centro(3,1)=88
 
    centro(3,2)=50
 
 
 
 
 
 
 
    x = r*cos(t)+ centro(i,1);
 
    y = r*sin(t)+ centro(i,2);
 
    mapshow(x,y,'Marker','+')
 
    % Intersect the polyline with the rectangle
 
[x, y] = polyxpoly(x, y, xbox, ybox)
 
Inter=horzcat(Inter,[x y])
 
 
 
mapshow(x,y,'DisplayType','point','Marker','x')
 
end


Saludos

https://www.facebook.com/royethmatlab
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Unir matrices

Publicado por Cristian (4 intervenciones) el 09/08/2015 00:37:42
Muchas gracias Royeth. Estaba un poco aproblemado con eso. Te lo agradezco!!!!


Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar