MATLAB Answers


How to plot with continuous line

Asked by K
on 24 Nov 2012

Hi, I have an array and I want to plot it into graph. My problem is I got a dotted graph line and not a continuous one. How should I change my code to solve this problem? My code look like this:

Figure(1) hold on

for i= 1:5 array(i) = i*3; plot (i, array(i)); end




No products are associated with this question.

1 Answer

Answer by Azzi Abdelmalek
on 24 Nov 2012
Edited by Azzi Abdelmalek
on 24 Nov 2012
 Accepted answer

Use plot after the loop

 for ii= 1:5
    array(ii) = ii*3; 
 plot (x, array); 

%don't use i and j as variables (used with comlex numbers)


on 24 Nov 2012 I understand..Thank you

on 24 Nov 2012

One more question. Do you know what is the maximum elements of array that Matlab can support?

I can't tell exactly, that depends on your matlab version, also on your computer power and memory. look at this link

Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!