for文でのデータ蓄積
    1 回表示 (過去 30 日間)
  
       古いコメントを表示
    
            for j=1:681
                tic
                t=abs(A2(j));
                z=A(j);
                n=angles(j);
                if t<5
                    c='.b';
                else
                    c='.r';
                end
             end
            polarplot(n,z,c);
            rlim([0 5000])
            thetalim([-120 120])
            rtickformat('%g mm')
            thetatickformat('degrees')
            rtickangle(-30)
            ax = gca;
            ax.ThetaZeroLocation = 'top';
            drawnow
            tok
for文で蓄積したデータを一気にplotしたいです。これだと、最後の点だけplotしてしまいます。
0 件のコメント
回答 (1 件)
  Takumi
      
 2020 年 2 月 3 日
        plotを重ねたいときはfigureをhold onしてください.こんな感じです
for j=1:681
    tic
    t=abs(A2(j));
    z=A(j);
    n=angles(j);
    if t<5
        c='.b';
    else
        c='.r';
    end
    polarplot(n,z,c);
    hold on
    rlim([0 5000])
    thetalim([-120 120])
    rtickformat('%g mm')
    thetatickformat('degrees')
    rtickangle(-30)
    ax = gca;
    ax.ThetaZeroLocation = 'top';
    drawnow
    toc
end
ところで,この方法だと計算に時間がかかります.for文を使わない方法にもチャレンジしてみてください.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
