필터 지우기
필터 지우기

In a while loop, I have to calculate S (net cash of an insurance company) depending on which events (E1, E2 or E3) happens first. I tried the following code, but its not working. Maybe someone can help me ...

조회 수: 1 (최근 30일)
lambda =...
T =..
.....
while (temps < T)
E1 = exprnd(1/(lambda*n));
E2 = exprnd(1/mu);
E3 = exprnd(1/(nu*n));
A = [E1, E2, E3];
if (min(A) = E1)
temps = temps + E1;
if (temps < T)
S = ......
end
else
temps = temps + E2;
if (temps < T)
S = .......
end
else
temps = temps + E3;
if (temps < T)
n(i) = ..........
S = ......
  댓글 수: 2
Rik
Rik 2020년 11월 18일
I don't understand what you want to do, or the reason behind any of your code. You don't explain your input data, nor the intended output. None of your code is commented, nor is it formatted correctly.
Mario Malic
Mario Malic 2020년 11월 18일
Neither working, provide proper code or write an example of it.
if (min(A) = E1)
else % elseif?
else % else

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

답변 (1개)

Alan Moses
Alan Moses 2020년 11월 23일
편집: Alan Moses 2020년 11월 23일
There seems to be few syntax errors in the code. You can use multiple elseif block under the if block but only a single else block. The variables ‘n’ and ‘S’ are being used as scalars and hence indexing into those variables may throw an error.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by