anonymous function + IF + fitnlm = possible?
Mostra commenti meno recenti
Hello. Is it possible to have an anonymous function combined with an If statement in a non-regression function? something like this --->
tbl = table(x1, x2, x3, y);
if table.x1 < 30
modelfun1 = @(b,x)(...Equation (1)...);
b0 = [1 1 1 ...];
else % table.x1 > 30
modelfun2 = @(b,x)(...Equation (2)...);
b0 = [1 1 1...];
mdl1 = fitnlm(tbl, modelfun1, b0)
mdl2 = fitnlm(tbl, modelfun2, b0)
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Live Scripts and Functions in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!