Effacer les filtres
Effacer les filtres

Change initial conditions to maximize Rsquared

2 vues (au cours des 30 derniers jours)
Wilfredo Huaman
Wilfredo Huaman le 8 Juil 2019
For example is there a way to tell matlab + or - these varaibles (X,Y,Z) by 0.001 as needed to maxamize the R squared value??
Such as a while loop that looks like this? this is a made up script for an example
X1 = 1
Y1 = 1
Z1 = 1
X2 = 1
Y2 = 1
Z2 = 1
Fit = fitlm(A,B);
R2 = Fit.Rsquared.Ordinary; ( gets an R squared lets assume not 1)
while R2 < 0.8
dx = 0.001 ( I want this dx to be + or - 0.001 somehow in order to maxamize R squared (R2))
X1 = X1 +dx
Y1 = Y1+dz
Z1 = Z1+dx
..... same for X2 Y2 Z2
A = sin(X1+Y1+Z1)
B=sin(X2+Y2+Z2)
Fit = fitlm(A,B);
R2 = Fit.Rsquared.Ordinary;
end

Réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by