Asked by 4st4rl04
on 16 Mar 2015

I am having trouble plotting some values in MATLAB (R2014a on a Mac). I really don't know what the problem is. Consider the following sequence of plots:

plot((1:3),[1e-150*0.2 0 0]);

plot((1:3),[1e-151*0.2 0 0]);

plot((1:3),[1e-152*0.2 0 0]);

plot((1:3),[1e-153*0.2 0 0]);

plot((1:3),[1e-154*0.2 0 0]);

For some reason MATLAB won't plot the ones with 1e-151/153. Anyone has an idea of why this can be?

Thanks!

Answer by Star Strider
on 16 Mar 2015

Use the hold function.

Try this:

figure(1)

plot((1:3),[1e-150*0.2 0 0]);

hold on

plot((1:3),[1e-151*0.2 0 0]);

plot((1:3),[1e-152*0.2 0 0]);

plot((1:3),[1e-153*0.2 0 0]);

plot((1:3),[1e-154*0.2 0 0]);

hold off

4st4rl04
on 16 Mar 2015

Star Strider
on 16 Mar 2015

The plot function plots to the open figure window, erasing any previous plots to it unless you use the hold function. When I ran my code (with hold in R2014b) it plotted all of them.

Similarly, this plots them all:

figure(1)

plot((1:3),[1e-150*0.2 0 0]);

figure(2)

plot((1:3),[1e-151*0.2 0 0]);

figure(3)

plot((1:3),[1e-152*0.2 0 0]);

figure(4)

plot((1:3),[1e-153*0.2 0 0]);

figure(5)

plot((1:3),[1e-154*0.2 0 0]);

James Tursa
on 16 Mar 2015

Going back a few versions on my machine:

Windows 32-bit

R2009a: Plots all of them

R2013a: Plots all of them

R2014a: Plots all of them

Windows 64-bit

R2010a: Does not plot all of them

R2013a: Does not plot all of them

R2013b: Does not plot all of them

R2014a: Does not plot all of them

R2014b: Plots all of them

Sign in to comment.

Answer by Jan
on 16 Mar 2015

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.