Editing Line Type Settings for data in a for loop
1 回表示 (過去 30 日間)
古いコメントを表示
I am plotting an array that enters a for loop 4 times and therefore produces 4 different arrays and 4 different curves. When plotting like this, how do I differentiate line type settings for different curves plotted by one plot command?
2 件のコメント
回答 (1 件)
Birdman
2018 年 1 月 17 日
Do something like following:
N = [20 13 56 72];
line={'--','b--o','->','-*'};
for i = 1:length(N)
% Create A matrix then..
f = ones(N(i),1);
h = 1/(N(i) + 1);
A_h = -A./(h.^2);
u = A_h\f;
x = linspace(0,1,N(i));
plot(x,u,line{i});hold on;
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Scatter Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!