Reducing Array size minimizing loss of data

19 views (last 30 days)
I believe the question is simple, but I'm more concerned about the method. So I need to do a simple V1-V2. But as V1 and V2 are derived from test data, they are of different sizes, V1 is 9000x1 and V2 is 15000x1. Both are plotted against z1(9000x1) and z2(15000x1) respectively, both of which go from 0 to 1.
What is the best method to reduce/increase the size without any loss of meaningful data. I can think of interpolating (interpn) or downsampling (downsample) the data I have to a fixed size like 6000x1, but I'm a bit skeptical as I will be using the result vector in developing a model which uses lsqcurvefit and other operations on top of that.

Answers (1)

Image Analyst
Image Analyst on 4 Apr 2022
Why do you think you need to reduce the data? The curve fitting routines should be able to handle that small amount of data with no problem. If your screen is, say 1980 pixels across, it will plot subsampled by a factor of about 8. So zoom way in and pan across to see if there are any "meaningful" data points that basically don't show up when you can see only 1980 (a screen's worth) of data? If not, then you could maybe just use interp1() to resample your data and your fit should be about the same, though like I said, the curve fitting routines will have no problem at all with the small amounts of data you have. So why not just send in all of your data?
  2 Comments
Lalith Chandra
Lalith Chandra on 4 Apr 2022
As I said, I need to a simple V1-V2. That is why I need to reduce the data. How can you use basic Arithmetic Operations if the Matrices are of different sizes? 9000x1 and 15000x1 in my case.
My question is not about visualizing my small amounts of data.
Image Analyst
Image Analyst on 4 Apr 2022
OK so you basically said "I need it because I need it."
And you don't want to visualize your data. But I'm not sure if you still need to do fitting anymore, or you just want to do arithmetic operations only.
How would you expect to handle different sized vectors? For example would you want to interpolate the smaller vector to expand it to the size of the larger vector? Or did you have something else in mind?

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!