Loop for repeating a process multiple times
    4 views (last 30 days)
  
       Show older comments
    
    Shahab Khan
 on 19 Nov 2019
  
    
    
    
    
    Commented: Shahab Khan
 on 20 Nov 2019
            Hello
I am trying to write a loop which can perfrom same calculation for different values.
I have variables: 
E       = 100;
I       = [1 2 3 4 . . . . 100]  % size 101*1
C       = 1;
Loss    = 13;
Loss_E  = (E*Loss)/100;
T_s     = E / I*C;
T_l     = Loss_E / I * C
T       = T_s + T_l
Can somehelp me with writing a loop which perform calculation for 
T
 for all values of 
I
.Thanks
0 Comments
Accepted Answer
  Erivelton Gualter
      
 on 19 Nov 2019
        You need to use the ./ operator to perform division of arrays.
Try this
E       = 100;
I       =  1:100;
C       = 1;
Loss    = 13;
Loss_E  = (E*Loss)/100;
T_s     = E./I*C;
T_l     = Loss_E./I*C;
T       = T_s + T_l
More Answers (0)
See Also
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!
