Change initial conditions to maximize Rsquared

1 回表示 (過去 30 日間)
Wilfredo Huaman
Wilfredo Huaman 2019 年 7 月 8 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by