How could i run the loop?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Dyuman Joshi
am 1 Jul. 2022
Bearbeitet: Dyuman Joshi
am 1 Jul. 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.
Antworten (1)
Krishna
am 1 Jul. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!