Hey,for following code the 3rd loops i need to have 2 variables m and q .Could anyone help?(adsbygoogle = window.adsbygoogle || []).push({});

Code (Matlab M):for t=1:maxiterations

toterror=0;

for j=1:numfeature

totslope=0;

for i=1:m&&q=1:numfeature

z=0;

for jj=1:numfeature

z=z+prevtheta(jj)*x(i,jj);

end

h=1.0/(1.0+exp(-z));

H=H+(x(i,q)*h*(1-h)*x(i,jj));

totslope=(totslope+(h-y(i))*x(i,j));

toterror=(toterror+-y(i)*log(h)-(1-y(i))*log(1-h));

end

toterror=toterror/numtrainsam;

theta(j)= theta(j)-H\totslope;

end

prevtheta=theta;

errorperiteration(t)=toterror/j;

end

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab -- how can i use a FOR loop if I have 2 variables changing

Tags:

Have something to add?

Draft saved
Draft deleted

Loading...

Similar Threads for Matlab loop variables |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

**Physics Forums | Science Articles, Homework Help, Discussion**