[Last Call] Learn how to a build a cloud-first strategyRegister Now


MATLAB smoothing question (noob)

Posted on 2009-12-22
Medium Priority
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

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

LVL 15

Accepted Solution

yuk99 earned 2000 total points
ID: 26113598
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


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This video teaches viewers about errors in exception handling.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month17 days, 23 hours left to enroll

830 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