Clear Filters
Clear Filters

How to extract formula from fitrgp.

3 views (last 30 days)
Gullanan on 22 Nov 2022
Answered: Gokul Nath S J on 26 May 2023
Hello, I try to find formula from my data it's have multi-input and 1 output ,first I try with 2 input and I got graph 3D to find my Z value (output) but I concern about future, cause it's will have more input, so I want to ask, is my method still work if I have more input ? if not then I need to find formula or anythng else? and how can I find formula?
ps1. although I can find graph 3D but I still can't find Z by interpolat method.
Num_Points = 100;
X_Lin = linspace(min(x),max(x),Num_Points);
Y_Lin = linspace(min(y),max(y),Num_Points);
[X,Y] = meshgrid(X_Lin,Y_Lin);
f = scatteredInterpolant(x, y, z);
Z = f(X,Y);
hold on;
plot3(x,y, z,'.r','DisplayName','Observations');
%% from this, it's a code that still error.
x_observed = 152054999201.746;
y_observed = 223791838401.46;
w_observed = interp2( X_Lin, Y_Lin, z,x_observed,y_observed);
if you help me to make my code can be useful, I will b very greatful.
ps2. apologize for my bad english and my bad story-telling.

Answers (1)

Gokul Nath S J
Gokul Nath S J on 26 May 2023
Hi Gullanan,
As per my understanding it seems that you are receiving an error while working with the interp2 command. Since the error message is not attached, I can give some possible suggestion which can be helpful.
Please refer the following example to understand the interp2 behaviour.
[x, y, z] = peaks(10);
interp2(x, y, v, 1, 3)
The variables x, y are unknown to the question. However for correctly debugging the question, one needs the information of x and y. It might be possible that the arguments which were passed to the interp2 is lacking some dimensional issue. The calculation of z should be made sure to observe the correct number of outputs.
For more information regarding the issue, Kindly refer the following link.
with regards,
Gokul Nath S J




Community Treasure Hunt

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

Start Hunting!