How can I increase the the number of data-points in a scattered data set?
Show older comments
I have a 461 by 3 matrix in which the first column is x coordinates, second one y and third one z coordinates. The values of the elements of z column is o. (i.e it is actually 2D data but I need 3D data for further calculation so I kept the third column.). The values of the data set are scattered values.
Now I want to get more coordinate values (x,y,z) within this data set. The z values will be zero.
Can I use the function interp1/2/3??? how??
My main problem is achieving the coordinate matrix with all (prev.+interpolated) values. The interp function shows the value of a desired point, but I do not need that.
Thanks in advance.
Accepted Answer
More Answers (3)
Kheya Banerjee
on 8 Jul 2013
0 votes
Kheya Banerjee
on 8 Jul 2013
0 votes
David Sanchez
on 8 Jul 2013
Just skip the sort command, I did it for testing purposes. The interp will create new point in between every consecutive pair of data:
M = my_50x3_data_matrix;
x_extended = interp(M(:,1),2);
% dobule the data in Y column
y_extended = interp(M(:,2),2);
% new data containing all data
M_new = [x_extended, y_extended, zeros(100,1)];
1 Comment
Shins K
on 2 Jul 2022
When I used the same code, I am getting the error message "Unrecognized function or variable 'interp'". Could you please let me know why it is so, if you know?
Categories
Find more on Discrete Data Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!