For loop operation on vectors

1 vue (au cours des 30 derniers jours)
Sohail Ahmed
Sohail Ahmed le 23 Avr 2016
Commenté : Sohail Ahmed le 23 Avr 2016
if true
function IB= ibtest(VCC)
RL =[1000, 10000, 200000, 400000, 600000, 800000, 1000000];
RB=22000; RP=50; R=470; B=300;
i=0;
for t=1:length(RL)
i=i+1;
IB(i)=((VCC - 2.1)*(RL(i) + RP)) / ( (RL(i) * RP) + (RB*(RL(i) + RP)) + (301 * 470 * (RL(i) + RP)) );
end
IB
end
% code
end
I expect IB to be vector having different values but this code give me IB as a vector but all the elements are identical... I dont know what is the problem?

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 23 Avr 2016
They are different, type
format long
IB
  1 commentaire
Sohail Ahmed
Sohail Ahmed le 23 Avr 2016
Thank you! It solved the problem.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by