Tricky questions
Tomaz Kostanjevec Uni Mb
tomaz.kostanjevec at uni-mb.si
Sat Jan 12 20:42:22 CET 2008
Hello,
>From Slovenia - big problem J. Waiting for answer.
In file is added problem.
Questions are:
//Question 1: how to draw lines for Z axes (represent time) out to matrix
data?
//Question 2: how to draw spline3d on the surface of dawned graph?
//Question 3: - hardest - how to draw multidimensional trend of that graph
with spline3d in Z direction?
// For all the answers - congratulations (I spend 20 hours on that)
Best regards,
Tomaz
Algorithm is that:
function [xx,yy,zz]=graf3d(A)
[n,m]=size(A) // matrix A
X=zeros(4,(n-1)*m)
for i=1:(n-1)
for j=1:(m-1) //posebej za j=m
X(1,(i-1)*m+j)= A(i,j)*cos((j-1)*2*%pi/m)
X(2,(i-1)*m+j)= A(i,j+1)*cos(j*2*%pi/m)
X(3,(i-1)*m+j)= A(i+1,j)*cos((j-1)*2*%pi/m)
X(4,(i-1)*m+j)= A(i+1,j+1)*cos(j*2*%pi/m)
end
end
for i=1:(n-1)
X(1,i*m)= A(i,m)*cos((m-1)*2*%pi/m)
X(2,i*m)= A(i,1)*cos(0)
X(3,i*m)= A(i+1,m)*cos((m-1)*2*%pi/m)
X(4,i*m)= A(i+1,1)*cos(0)
end
Y=zeros(4,(n-1)*m)
for i=1:(n-1)
for j=1:(m-1) // posebej za j=m
Y(1,(i-1)*m+j)= A(i,j)*sin((j-1)*2*%pi/m)
Y(2,(i-1)*m+j)= A(i,j+1)*sin(j*2*%pi/m)
Y(3,(i-1)*m+j)= A(i+1,j)*sin((j-1)*2*%pi/m)
Y(4,(i-1)*m+j)= A(i+1,j+1)*sin(j*2*%pi/m)
end
end
for i=1:(n-1)
Y(1,i*m)= A(i,m)*sin((m-1)*2*%pi/m)
Y(2,i*m)= A(i,1)*sin(0)
Y(3,i*m)= A(i+1,m)*sin((m-1)*2*%pi/m)
Y(4,i*m)= A(i+1,1)*sin(0)
end
Z=zeros(4,(n-1)*m)
for i=1:(n-1)
for j=1:m
Z(1,(i-1)*m+j)= i
Z(2,(i-1)*m+j)= i
Z(3,(i-1)*m+j)= i+1
Z(4,(i-1)*m+j)= i+1
end
end
xx=X
yy=Y
zz=Z
f=plot3d(xx,yy,zz)
endfunction
A=[30 10 5 5 20 10
10 10
30 11 6 7 17 8
6 15
31 12 6 6 15 8
7 15
33 12 6 7 15 8
8 11
34 14 7 8 13 9
9 6
32 15 6 7 14 7
8 11
34 16 4 6 12 8
9 11
36 18 4 4 11 7
10 10
37 19 3 3 11 7
7 13
38 19 2 3 10 8
6 14
43 17 2 2 12 8
8 8]
xtitle("3D")
graf3d(A)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20080112/aa6e8ed7/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graf3d eng
Type: application/octet-stream
Size: 1899 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20080112/aa6e8ed7/attachment.obj>
More information about the users
mailing list