Clear Filters
Clear Filters

Create a solid line instead of single points in the plot

1 view (last 30 days)
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');

Answers (2)

VBBV
VBBV on 24 Apr 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 Comment
VBBV
VBBV on 24 Apr 2024
Edited: VBBV on 24 Apr 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.

Sign in to comment.


Steven Lord
Steven Lord on 24 Apr 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.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!