Borrar filtros
Borrar filtros

Connecting line

1 visualización (últimos 30 días)
Chaklader Asfak
Chaklader Asfak el 19 de Ag. de 2011
I have a excel file from where I made plot3. The Excel file is here: http://www.4shared.com/file/Gcoz8xa0/Contour.html and coding of the M-file is :
clear all
[Num,Txt,Raw]=xlsread('Contour.xlsx');
a=Num(:,1);
b=Num(:,2);
c=Num(:,3);
d=Num(:,4);
e=Num(:,5);
f=Num(:,6);
figure(3);
plot3(c,b,a,'-+r',e,f,d,'--og')
grid on
xlim('auto')
ylim('auto')
zlim('auto')
xlabel('X')
ylabel('Y')
zlabel('Z')
I need to connect all the points of the two lines along Z axis (from z= 5 to 20 each points)(Say, for Z=5, [b,c]= (1.1, 24)and [e,f]=(-34,1.5) ) . Any one can help me how to connect these points ?

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 19 de Ag. de 2011
added after your code
hold on
k = reshape([3 2 1 5 6 4],3,[]);
arrayfun(@(i1)plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:))),1:size(Num,1))
  2 comentarios
Chaklader Asfak
Chaklader Asfak el 19 de Ag. de 2011
Thanks. I can understand the reshape one but could you please explain about the arrayfun function ? What is i1 here ?
Andrei Bobrov
Andrei Bobrov el 19 de Ag. de 2011
i1 - variable in anonymous function @(i1)plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:)))
% analog use loop
for i1 = 1:size(Num,1)
plot3(Num(i1,k(1,:)),Num(i1,k(2,:)),Num(i1,k(3,:)));hold on;
end

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by