|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Roma
Messaggi: 596
|
[Matlab] Conversione ciclo for scritto in C in codice MATLAB
Codice:
y1_stim=zeros(length(y), 1);
for i = 1:length(y)
X1 = zeros(length(y) - 1, 2);
y1 = zeros(length(y) - 1, 1);
for r = 1:length(X1)
if r < i
X1(r, 1) = X(r, 1);
X1(r, 2) = X(r, 2);
y1(r, 1) = y(r, 1);
else
X1(r, 1) = X(r+1, 1);
X1(r, 2) = X(r+1, 2);
y1(r, 1) = y(r+1, 1);
end
end
mdl = fitnlm(X1,y1,modelfun,beta0);
b = mdl.Coefficients.Estimate;
y1_stim(i, 1) = b(1) + b(2)*X(i, 1);
end
Thx
__________________
Ho trattato positivamente con: luigi864, mauro2671, Nick.sf (x2), Jap2, wettam83, Fede, Rasoiokia, musgo90, ewandeep, blueworld2000, zanca.racing, maxninni |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Roma
Messaggi: 596
|
Ottimo, grazie
__________________
Ho trattato positivamente con: luigi864, mauro2671, Nick.sf (x2), Jap2, wettam83, Fede, Rasoiokia, musgo90, ewandeep, blueworld2000, zanca.racing, maxninni |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:26.



















