<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Le 22/09/2011 12:01, scibie a écrit :
<blockquote cite="mid:1316685669966-3358251.post@n3.nabble.com"
type="cite">
<pre wrap="">I have a 3d trajectory plot created using param3d1.
I need to project the 3d trajectory plot to XY plane with color
changes (from actual 3d trajectory TO xy-plane projected trajectory
plot) according to altitude (z), like a colored waterfall.
Kindly let me know how it could be done using Scilab.
</pre>
</blockquote>
Yes it is possible as a series of adjacent but individual colored
segments.<br>
Hereabove is an example that you may adapt for your own purpose.<br>
<br>
Best regards<br>
Samuel<br>
<br>
==========<br>
// Preparing data:<br>
theta = linspace(0,8*%pi,200);<br>
r = 1 - 0.8*theta/(8*%pi);<br>
x = r.*cos(theta);<br>
y = r.*sin(theta);<br>
z = 0.5+theta/10;<br>
<br>
// Plotting the 3D parametric curve<br>
clf<br>
param3d1(x,y,z)<br>
<br>
// Extending the z axis down to 0 in order to plot the (x,y) projection
onto the z=0 plane:<br>
a = gca();<br>
a.data_bounds(1,3)=0; <br>
<br>
// Preparing and updating the colormap:<br>
ind = addcolor(rainbowcolormap(100));<br>
<br>
// Mapping z with the generated rainbow colors:<br>
zmin = min(z);<br>
zmax = max(z);<br>
zcol = ind(round(interp1([zmin zmax],[1 100],z)));<br>
<br>
// Plotting the projection as a set of adjacent but individual colored
segments:<br>
X = [x(1:$-1);x(2:$)];<br>
Y = [y(1:$-1);y(2:$)];<br>
xpolys(X,Y,zcol(1:$-1)) // That's it<br>
<br>
=======<br>
<img src="cid:part1.00070902.02070501@free.fr" alt=""><br>
<br>
</body>
</html>