MATLAB smoothing question (noob)

Posted on 2009-12-22
Last Modified: 2016-02-10
This may sound like a repeat question, but I thought I had it figured out, but now it doesn't work anymore.

I have been provided a file called "data.txt"  that contails about 20,000 entries that look like:


col1 represents time_axis
col2 represents voltage

I use the import this into a variable: vdata.  Which in my right hand variables box shows up as vdata  <2003925x2>

Now I need to plot a smoothed version of volt_data against the same time axis.

Now I execute:
>>> sm_vdata = smooth(data)

which provides variable:  sm_vdata size <4007850x1>.

Obviously somethings wrong.  I need sm_vdata array to be the same size as v_data array with the same time values.

How do I do this?

Thanks in advance for any advice.
Question by:tmonteit

    Author Comment

    Also I need to put them both on a side-by-side plot.  How do I do that?

    LVL 15

    Accepted Solution

    SMOOTH convert your vdata matrix to a vector and smooth all together. You have to smooth col2 separately. I don't have Matlab now to test the code, but it should work:
    time_data = vdata(:,1);
    volt_data = vdata(:,2);
    volt_data_sm = smooth(volt_data);
    % then your can plot the data
    hold on
    hold off

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    Title # Comments Views Activity
    Hibernate methods 2 45
    Discrete Values 2 35
    sum67 challenge 35 76
    has22 challenge 11 56
    The purpose of this article is to demonstrate how we can use conditional statements using Python.
    Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now