MATLAB smoothing question (noob)

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.
Who is Participating?
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

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.