2013-03-29 33 views
3

我在千里馬寫了一個代碼,我有三個地塊。我沒有任何麻煩繪製這些單獨的,但我不知道如何讓他們都在一個陰謀,而不是在一個for循環做,而不是過多的細節這將是很難與我的代碼。千里馬的多個地塊

for i:1 step 1 while i<=n-1 do(figgdown[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[p[i],p[i]]])); 
    for i:1 step 1 while i<=n-1 do(figgup[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[q[i], q[i]]])); 
    for i:1 step 1 while i<=n-1 do(figgmiddle[i]:plot2d(
    [discrete,[xx[i], -xx[i]],[pq[i], pq[i]]])); 

有沒有辦法,我可以做一些像數學中的顯示功能,在圖形一起出現? 最佳, 本

回答

3

你可以保持一個列表

n: 10; 
x: makelist(2*%pi*i/n, i, 0, n); 

p: []; 
y1: sin(x); 
p: endcons([discrete, x, y1], p); 

y2: cos(x); 
p: endcons([discrete, x, y2], p); 

/* display all plots in p */ 
plot2d(p);