精華區beta MATLAB 關於我們 聯絡資訊
由於之前滿想畫畫看 立體圖的 但是想不到更好的方法 用以下比較陽春瞄點的方式畫 如果有人有更好又簡便的方式 請分享一下 說明:畫球 但是由於間距設的沒有很大 所以會像地球經緯線 圖形 確實像經緯線 但是 那其實是 無聊 畫兩次 一個固定theta 另個固定ph==>一次畫經線 一次畫緯線 (只有跑以下其中依個迴圈即可 只是hold on hold off 要重擺) R=1; delta=20*pi/360; theta=0:delta/2:pi; n=length(theta); I=repmat(1,1,n); x0=1;y0=2;z0=3; hold on for ph=0:delta:2*pi; x=x0+R*sin(theta)*cos(ph).*I; y=y0+R*sin(theta)*sin(ph).*I; z=z0+R*cos(theta).*I; plot3(x(1:n),y(1:n),z(1:n),'r') end R=1; delta=20*pi/360; ph=0:delta:2*pi; n=length(ph); I=repmat(1,1,n); x0=1;y0=2;z0=3; for theta=0:delta/2:pi; x=x0+R*sin(theta)*cos(ph).*I; y=y0+R*sin(theta)*sin(ph).*I; z=z0+R*cos(theta).*I; plot3(x(1:n),y(1:n),z(1:n),'b') end hold off -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.187.145.67