Generate new samples from available data

3 views (last 30 days)
Hi I have three variables (a,b,c) as input and their output is a variable d. I have generated 30 samples by varying inputs and getting output. Now i want to generate new samples using the data of available samples. Please guide me how to do this in Matlab. These are not random data samples.

Accepted Answer

Star Strider
Star Strider on 20 Jan 2022
This seems to be an interpolation problem, such that the original data are created by the original values, and the desire is then to interpolate within the ranges of ‘a’, ‘b’, and ‘c’ to get new values.
If this is correct, use the scatteredInterpolant function to find the new values.
  6 Comments
Star Strider
Star Strider on 20 Jan 2022
Edited: Star Strider on 20 Jan 2022
My pleasure!
It may be necessary to re-calculate ‘d’ using the ndgrid matrices in order for it to work with my code.
EDIT — (20 Jan 2022 at 16:52)
To calculate ‘d’ and use my code to interpolate values from it, it would be necessary to use the ‘Am’, ‘Bm’, and ‘Cm’ matrices to calculate it, using element-wise operations. (See Array vs. Matrix Operations for the necessary information on that.)
That will create a ‘Dm’ matrix output. Then use the rest of my code to interpolate values of ‘d’ for the desired ‘a’, ‘b’, and ‘c’ inputs, using the scatteredInterpolant code in my earlier Comment.
Calculating it in a loop using the vectors may not produce the correct result if the loop calculations produce something different from what ‘Dm’ would be in my code.
I can write specific code to do that if I have the function that creates ‘d’.
.

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 20 Jan 2022
How about just getting a random number from each of your input ranges. Like:
a = [100 200 300];
b = [11 12 13];
c = [600 900 1200];
numPointsNeeded = 4 % Or 1 or 30 or however many you need.
aNew = a(1) + (a(3) - a(1)) * rand(1, numPointsNeeded)
bNew = b(1) + (b(3) - b(1)) * rand(1, numPointsNeeded)
cNew = c(1) + (c(3) - c(1)) * rand(1, numPointsNeeded)
  4 Comments
Haris Hameed
Haris Hameed on 20 Jan 2022
a,b,c are geometric parameters like radius, diameter and lenght. Now for different values of these i calculate aerodynamic drag that is "d" using a separate code (computational fluid dynamics). Now since i have manually calculated 28 points, i want to generate more data using these 28 calculated points. For this i am asking some method.
Image Analyst
Image Analyst on 20 Jan 2022
Not sure how the existing 28 d values will enable you to get more values for d.
if d1 = function(a, b, c) and you want a new set d2. I don't see how you can get new d2 only from d1 (the "calculated 28 points"), while not using new a,b,c values, unless you just create a distribution of d1 and try to get random values from it. Like a statistical estimation/prediction.
I think the best way would be to get some more values for a, b, and c and compute your new d values. So you can either get random a, b, c values, OR you can do it in some systematic way (like doing all values of a, b, and c). I showed you both ways.

Sign in to comment.

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!