# How to extract formula from fitrgp.

2 Ansichten (letzte 30 Tage)
Gullanan am 22 Nov. 2022
Beantwortet: Gokul Nath S J am 26 Mai 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);
surf(X,Y,Z);
xlabel('x'),ylabel('y'),zlabel('z')
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);
disp(w_observed);
if you help me to make my code can be useful, I will b very greatful.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Gokul Nath S J am 26 Mai 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.
with regards,
Gokul Nath S J
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Dimensionality Reduction and Feature Extraction finden Sie in Help Center und File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by