I have doubt in writing if else statement
조회 수: 3 (최근 30일)
이전 댓글 표시
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1354253/image.jpeg)
φ_((c1j) )={█((-1)^k φ_((C1j) ),1+j=2k (k=1,2,…)@(-)^k φ_((C1j), ) 1+j=2k+1 (k=1,2,…))┤
φ_((ci1) )={█((-1)^k φ_((ci1) ),i+1=2k (k=1,2,…)@(-1)^(k+1) φ_((ci1), ) i+1=2k+1 (k=1,2,…))┤
댓글 수: 3
Walter Roberson
2023년 4월 13일
So you have two different expressions for each of the two functions, depending on whether i or j is odd or even.
But I can't help but think that you missed out on something. What does
mean?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355248/image.png)
You have defined
in terms of a value times
-- the same quantity. That is only going to work if the quantity
is 1 or if you can show that the constraints are such that the value
must be zero.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355253/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355258/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355263/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355268/image.png)
But is
== 1? If j is odd then 1+ j == 2*k can be true -- but k could be even or odd. For example, j = 3, 1+j = 2*2 so k = 2. But j = 5, 1+j = 2*3 so k = 3. Generally speaking, k = (j+1)/2 for odd j. So
must be simultaneously (-1)^1 *
and (-1)^2 *
. Which can only happen if
is identical to 0 .
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355273/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355278/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355283/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355288/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1355293/image.png)
Unless, that is, you missed something like a summation.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Time Series Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!