Generate new samples from available data
조회 수: 5 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
채택된 답변
Star Strider
2022년 1월 20일
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.
댓글 수: 6
Star Strider
2022년 1월 20일
편집: Star Strider
2022년 1월 20일
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’.
.
추가 답변 (1개)
Image Analyst
2022년 1월 20일
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
Image Analyst
2022년 1월 20일
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!