PLOT question for discontinuity

Discussion in 'MATLAB' started by ysjung, Jan 17, 2005.

  1. ysjung

    ysjung Guest

    Hi all,

    I was wondering if ther is command in matlab for not showing vertical
    line.

    I have this code for an example ...

    % square wave
    t = linspace(0,10,20);
    T = 8;
    d = 25
    tmp=mod(t,T);
    w0=T*d/100;
    y = (tmp < w0);
    plot(t,y,t,y,'.r');
    axis([1 10 -0.1 1.1]);

    I am trying to to get rid of every vertival line and no! I do not
    want point plot (ex:plot(t,y,'.b') - I do not want this, I want
    plot(t,y,'-b')).

    I was wondering if there is way to plot this graph with "line" but
    get rig of vertival line with out having to loss single point of
    data.

    I have tried x(something) = nan;
    command, but it deletes one data point which I do not want.

    please help me ...
     
    ysjung, Jan 17, 2005
    #1
    1. Advertisements

  2. ysjung

    Ken Davis Guest

    x = [1 2 2 2 3 4 4 4 5]
    y = [0 0 NaN 1 1 1 NaN 0 0]
    plot(x,y); axis([0 5 -1 2])
     
    Ken Davis, Jan 17, 2005
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.