How could i run the loop?

조회 수: 6 (최근 30일)
M.Rameswari Sudha
M.Rameswari Sudha 2022년 7월 1일
편집: Dyuman Joshi 2022년 7월 1일
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
M.Rameswari Sudha
M.Rameswari Sudha 2022년 7월 1일
while I was running the program we get,
??? Undefined function or method 'times' for input arguments of type
'cell'.
Error in ==> Imperfect at 24
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)));
Dyuman Joshi
Dyuman Joshi 2022년 7월 1일
편집: Dyuman Joshi 2022년 7월 1일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Krishna
Krishna 2022년 7월 1일
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:

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2009b

Community Treasure Hunt

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

Start Hunting!

Translated by