Bug in Matlab 7? why does this happen--scalar division or vector division?

Discussion in 'MATLAB' started by kiki, Oct 28, 2004.

  1. kiki

    kiki Guest

    Dear all,

    I want to see the plot of "z/w" where "z" and "w" are defined as follows:

    z=((normcdf(1-y, 0, 1)-normcdf(-y, 0, 1))-(normcdf(-y, 0, 1)-normcdf(-1-y,
    0, 1)));
    w=normcdf(1-y, 0, 1)-normcdf(-1-y, 0, 1);

    % 1)

    plot(y, z/w)

    % I got a result which is zero everywhere on the plot...

    % 2)

    plot(y, z./w)

    % I got a non-zero plot which is the correct one...

    I understand now that the second one is correct, since z and w are vectors,
    so I should use element-wise division.

    The problem is that I don't understand why in the first approach that the
    "plot(y, z/w)" generates a zero-result plot?

    In my understanding, if the vector over vector does not abide by the syntax,
    the Matlab syntax check should raise an error saying "subscript

    But this time it did not raise any error so I had been wasting a lot of time
    by assuming the zero-results were correct...

    So why "z/w" (z and w are non-zero, but zero at only some points) gives zero

    Thanks a lot
    kiki, Oct 28, 2004
    1. Advertisements

  2. kiki

    the cyclist Guest

    kiki wrote:

    "z/w" is a valid matrix division, albeit a little beyond my
    understanding for vectors rather than matrices. See "help slash" for
    how it is defined.
    the cyclist, Oct 28, 2004
    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.