Create a solid line instead of single points in the plot

7 vues (au cours des 30 derniers jours)
Christoph
Christoph le 24 Avr 2024
My Problem is I calculated curves out of 81 Data points and want to plot it as a solid line. If I plot it, the only way it shows the curve is as points, stars etc. As you can see in the picture below.
I have to do this seven times.
The code for this is:
imax is from 1 to 7 an (each curve)
N is from 1 to 81 and are my data points
The rest is calculated before but not relevant for the problem
vR=ones(imax,N);
FZA2=ones(imax,N);
vR(k,h)=(2*pi*rdyn)*(nR(k,h)/60)*3.6;
FZA2(k,h)=(T2(h,1)*i2(k)*i2E*nges)/rdyn; %in N
plot(vR(1,h),FZA2(1,h),'.b',vR(2,h),FZA2(2,h),'.r',vR(3,h),FZA2(3,h),'.g',vR(4,h),FZA2(4,h),'.c',vR(5,h),FZA2(5,h),'.y',vR(6,h),FZA2(6,h),'.m',vR(7,h),FZA2(7,h),'.b');

Réponses (2)

VBBV
VBBV le 24 Avr 2024
If the plot function is inside a loop, you could put it outside the loop as shown below, in order to plot solid line
plot(vR(1,:),FZA2(1,:),'b-',vR(2,:),FZA2(2,:),'r-',vR(3,:),FZA2(3,:),'g-', ...
vR(4,:),FZA2(4,:),'c-',vR(5,:),FZA2(5,:),'y-',vR(6,:),FZA2(6,:),'m-',vR(7,:),FZA2(7,:),'b-');
  1 commentaire
VBBV
VBBV le 24 Avr 2024
Modifié(e) : VBBV le 24 Avr 2024
From your code, it shows that you try to plot scalars which need markers ,instead if you plot vectors, you can obtain a solid line without markers. You can also avoid, the repetition inside the plot function, by using a for or a while looop.

Connectez-vous pour commenter.


Steven Lord
Steven Lord le 24 Avr 2024
Rather than plotting individual points inside a loop (as @VBBV and I both suspect you are doing) you could pull the plot command out of the loop (as VBBV suggested previously) or you could create an animatedline before the loop and addpoints to it inside the loop.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by