how to get output for n values in for loop
Show older comments
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 Comments
ME
on 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
on 27 Nov 2019
Jan
on 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.
Answers (0)
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!