Re: [問題] 產生random vector已回收

看板MATLAB作者 (Achilles)時間16年前 (2009/03/20 03:16), 編輯推噓1(101)
留言2則, 1人參與, 最新討論串7/7 (看更多)
※ 引述《microball (無華之果)》之銘言: 不好意思, 我依然看不懂你再說什麼, 建議你在寫出你的 code 之前, 用幾句話去描述一下你的演算法, 不然很難閱讀你的程式. (Degub is always the hard work.) : N = 1000; : aG = 2*pi.*rand(N,1); : bG = pi.*rand(N,1); : cG = 2*pi.*rand(N,1); You generate 3 random angles ? : RandR = zeros(N,3); : z1 = [1 0 0]; : for (j = 1:N) : a = aG(j); : b = bG(j); : c = cG(j); : Ea = [cos(a) sin(a) 0; -sin(a) cos(a) 0; 0 0 1]; : Eb = [1 0 0; 0 cos(b) sin(b); 0 -sin(b) cos(b)]; : Ec = [cos(c) sin(c) 0; -sin(c) cos(c) 0; 0 0 1]; : RandR(j,:) = (Ec*Eb*Ea*(z1'))'; : end : plot3(RandR(:,1),RandR(:,2),RandR(:,3),'.') It means 3 rotation matrix. Q(x,y) and Q(y,x), Q(x,y). (Hope I got it right?) Here is the question: 1. Why you need 3 rotation ? It's a 2D random-ness. 2. If you only do for Eb*Ea*(Z1). it's exaxtly the answer you gave before, which can be proved as wrong. How do you explain yourself, convince others that's a correct one ? -- 趙客縵胡纓,吾鉤霜雪明。銀鞍照白馬,颯沓如流星。 十步殺一人,千里不留行。是了拂衣去,深藏身與名。 閑過信陵飲,脫劍膝前橫。將炙啖朱亥,持觴勸侯贏。 三杯吐然諾,五嶽倒為輕。眼花耳熱後,意氣素霓生。 就趙揮金錘,邯鄲先震驚。千秋二壯士,烜赫大梁城。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 76.171.164.195

03/20 04:48, , 1F
我還沒想出來...這也不是我的作業
03/20 04:48, 1F

03/20 04:48, , 2F
我只是試試看用 euler angle 做會怎樣
03/20 04:48, 2F
文章代碼(AID): #19mfe75X (MATLAB)
文章代碼(AID): #19mfe75X (MATLAB)