How could i run the loop?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to get the value for q,v and TC. I couldnt solve this problem using this code. Can anyone help me?
clc
close all
k=50;
c=20;
h=2;
H=2;
w0=20;
w1=0.1;
s=40;
del=0.05;
alpha0=0.08;
k0=50;
c0=1;
lambdai = [220 250 280 310 500];
lambda=1250;
the2=0.5;
mu=[500 500 500 500 500];
b=[50 70 100 120 130];
M = zeros(length(lambdai), length(b), length(mu));
for i = 1:length(lambdai)
C(i) = lambdai(i);
rho(i)= (1-(lambdai(i)./mu(i)));
B1(i)=((b(i).*lambdai(i))./lambda);
q(i)=sqrt(((H+c0.*w1.*the2+b(i)).*w0.*the2)./(s.*alpha0.*del.*(1-rho(i)).*rho(i)+(H+c0.*w1.*the2).*rho(i).*{2}).*(H+c0.*w1.*the2+b(i)));
v(i)=-((H+c0.*w1.*the2).*rho(i).*q(i))./((H+c0.*w1.*the2+b(i)))
mu1(i)=mu(i);
TC(i)=c.*lambda(i)+y.*(a.*log(k0./k)+b(i).*log(beta0./beta))+(q(i)./2.*rho(i)).*((s.*alpha0.*del.*(1-rho(i)).*rho(i))+(H+c0.*w1.*the2).*rho(i).^{2}.*b(i).^{2}+((b(i).*((H+c0.*w1.*the2).*rho(i)).^{2})./(H+c0.*w1.*the2+b(i))).^{2})+(c0.*w0.*the2./q(i))
i=1+1
end
TCC=TC(i)
3 commentaires
Dyuman Joshi
le 1 Juil 2022
Modifié(e) : Dyuman Joshi
le 1 Juil 2022
q(i)=sqrt(((H+c0.*w1.*the2+b(i)).*w0.*the2)./(s.*alpha0.*del.*(1-rho(i)).*rho(i)+(H+c0.*w1.*the2).*rho(i).*{2}).*(H+c0.*w1.*the2+b(i)))
Check the bold part. Why is 2 put in curly brackets?
Same is done for TC(i) as well.
Réponses (1)
Krishna
le 1 Juil 2022
Hey Rameswari,
You are facing the issue in this line.
q(i)=sqrt(((H+c0.*w1.*the2+b(i)).*w0.*the2)./(s.*alpha0.*del.*(1-rho(i)).*rho(i)+(H+c0.*w1.*the2).*rho(i).*{2}).*(H+c0.*w1.*the2+b(i)));
and
TC(i)=c.*lambda(i)+y.*(a.*log(k0./k)+b(i).*log(beta0./beta))+(q(i)./2.*rho(i)).*((s.*alpha0.*del.*(1-rho(i)).*rho(i))+(H+c0.*w1.*the2).*rho(i).^{2}.*b(i).^{2}+((b(i).*((H+c0.*w1.*the2).*rho(i)).^{2})./(H+c0.*w1.*the2+b(i))).^{2})+(c0.*w0.*the2./q(i))
Check the following link:
Also follow this tutorial to get better response in Matlab Answers:
0 commentaires
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!