how to get output for n values in for loop
Afficher commentaires plus anciens
clc;
learningrate=0.11;
e=0;
t1=ga.time;
t=nonzeros(t1);
x=ga.signals.values;
disp(t);
w=abs(x);
p=nonzeros(w);
disp(p);
y=ga1.signals.values;
d=abs(y);
h=nonzeros(d);
disp(h);
for t=1:10
if p(t)==h(t)
h(t+1)=p(t)-(learningrate*e(t));
else
k(t)=p(t)-h(t);
%disp(k);
end
e(t)=min(k(t));
%disp(e(t))
h(t+1)=p(t)-(learningrate*e(t));
Ga1=h(t+1);
%disp(Ga1)
if Ga1==h(t)
%disp(Ga1)
else
break
end
end
disp(Ga1)
fprintf("Euclidean distance %f k(%d)\n",k(t),t);
fprintf("Minimum Euclidean distance %f e(%d)\n",e(t),t);
fprintf("Used for extraction of current values %f\n",Ga1);
3 commentaires
ME
le 27 Nov 2019
What exactly is the question here?! This is just a section of code but there is no description of what you actually want.
Jyothi Polathala
le 27 Nov 2019
Jan
le 28 Nov 2019
@Jyothi Polathala: I've formatted your code to improve the readability. You can do this by your own in future questions.
You still did not ask a question. It is hard to recognize the correltation between your code and teh explanations. Please mention exactly, what you want to achieve.
Réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!