Hi guys could you please help me in this if i could make loop like? I have attached m file too.
Show older comments
for k=1:N
j=1
E_1=1;
while E_1>10^(-6)
j=j+1;
Calculate values;
Error=abs(calculated - assumed);
E_1=Error;
end
While
end
end
5 Comments
John Petersen
on 8 Jan 2015
It looks "loop" like to me already. What is your problem?
Daya
on 8 Jan 2015
per isakson
on 8 Jan 2015
replace
while E_1>10^(-6)
by
while E_1>10^(-6) && j<1e6
Stephen23
on 8 Jan 2015
Note: don't use i or j as the loop variables, as these are the names of the inbuilt imaginary unit .
Jan
on 9 Jan 2015
Remark: 10^(-6) is an expensive power operation, while 1e-6 is a constant.
Accepted Answer
More 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!