zero all the data points

Home Forums Matlab zero all the data points

This topic contains 3 replies, has 2 voices, and was last updated by  cK 8 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #604

    Aero123
    Participant

    I have a matrix set of V=(30X50000);

    Now I plot each row as plot(V(1,:)),plot(V(2,:))…..etc.

    None of these plots start from the origin (0,0).

    What is the best way to change the data set such that every plot starts from (0,0).

    range of the shift is from y=0.3 for 1st row in the matrix to y=0.4 for the last row in the matrix(30,:).

    Thanks.

    #605

    cK
    Keymaster

    It’s not clear which axis zero you are referring to or you want your lineseries to start from (0,0).

    If you want the first point to start with 0 in y-axis just insert the number “0″ at the very beginning of the array in each column.
    x = [zeros(1,size(x,2));x];

    If you want the first point to start with 0 in x-axis, you need to specify the vector of x-axis data to start from 0. If you say plot(y), data in vector y is plotted against the linear indices which start from 1. Instead do plot(0:size(V,2)-1,V(1,:))

    #606

    Aero123
    Participant

    In the plot attached below we see that there’s an offset with respect to origin. This is what I just did

    plot(xvalues(1,50000),yvalues(1,50000)). I want to shift the y axis to origin point so that curve starts from (0,0).

    There are 50 such plots (50 vectors) and each have different offset value. but the xvalues remain the same for all these vectors. suggest me the best way to offset all these vectors to zero. Thanks

    Attachments:
    You must be logged in to view attached files.
    #608

    cK
    Keymaster

    Just subtract the respective offset values from the vectors.
    xvalues2 = xvalues - xvalues(1);

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.