Hello everyone, I am facing one problem,

I have 3 different non linear data. Let's say x,y and z.for different values of Z I have different data set of x and y. If I fix the value of Z I am able to find the relation between x and y, but if I change the value of Z that relation won't work, I need to find relation between x,y and z independently. Can anyone please help! Thank you in advance.
for z=500 I have x = 1145 to 1240 with the gap of 1,y = (17.75,16.2,15.1,14.25,13.45.... respectively
for z=400, x values remains the same 1145-1240 y values differs.
I need to find a relation between x,y and z independently. in which y = fun(x,z). thank you.

 Accepted Answer

Try the attached code where I fit an exponential growth curve to each curve, which belongs to each x value. It uses fitnlm() of the Statistics and Machine Learning Toolbox.
0001 Screenshot.png

1 Comment

Is it possible to get only one equation for this? As we are getting different coefficients, there will be different equations.

Sign in to comment.

More Answers (1)

For each z, get or compute the x and y arrays. Then fit a model for y using the x array, and the scalar value of z for those arrays. In pseudocode:
z = [......] % Some list of z values
for k = 1 : length(z)
thisZ = z(k);
xVector = ...% Whatever you need to do to get the x vector for this z
yVector = ....% Whatever you need to do to get the y vector for this z
% Now find some model passing in the xVector and yVector and this z value.
yourModel = FitModel(xVector, yVector, thisZ);
% Now do something with the model, like apply it, save it, plot it, or whatever.....
end
I have no idea what the model for each pair of x and y vectors might be. Would they all be the same, like fitting a line or parabola? Would they be different, like some might be a line and others might need an exponential decay? Would it be empirical so you don't have model parameters, but just a smoothed/fitted y vector as output, like as if you applied smooth() or sgolayfilt() to the raw data? We have no idea since you didn't share that information with us.

3 Comments

Thank you Image Analyst. Here is the data. You might get idea from this, what I wanted to find.
for x = 1145
y = [200 300 400 500]; I have z = [ 3.76 5.27 7.88 17.75]
for x = 1155
y = [200 300 400 500]; I have z = [ 3.4055 5.64 6.43 10.3]
for x = 1165
y = [200 300 400 500 600]; I have z = [3.1 4.115 5.48 7.78 14.6]
for x =1175
y = [300 400 500 600 700]; I have z = [3.71 4.79 6.37 9.45 28]
for x =1185
y = [300 400 500 600 700]; I have z = [3.37 4.26 5.44 7.33 11.8]
for x =1195
y = [300 400 500 600 700 800]; I have z = [3.085 3.833 4.77 6.1 8.42 15.5]
for x =1205
y = [400 500 600 700 800 900]; I have z = [3.485 4.25 5.259 6.77 9.7 11.25]
for x =1215
y = [400 500 600 700 800 900]; I have z = [3.191 3.82 4.638 5.72 7.46 8.2]
for x =1225
y = [500 600 700 800 900]; I have z = [3.4955 4.155 4.99 6.18 8.2]
for x =1235
y = [500 600 700 800 900]; I have z = [3.21 3.761 4.435 5.325 6.63]
This data I have. I need to find now z=function(x,y) so I can directly find the value of z from the values of x and y, because x and y are known values.
Why do the first two have only 4 points, and the others have 5 or 6 points? Why aren't they all the same size?
Attached is what I have so far.
0001 Screenshot.png
I didn't go further because I don't think you have enough points in there to do meaninful fits. Attach more data.
For first two point the value is not possible that's why. Like for the big value of x , z is not possible.

Sign in to comment.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!