How to solve following difference equation using Matlab
이전 댓글 표시
Hello,
Please help me to solve following difference equations using Matlab
p(n)= p(n-1) + (1- p(n-1)) * p(0)
p(n)= p(n-1) * gamma^k
with initial conditions
p(0) =1, gamma= [0,1]
also from both equations
gamma= (1-(1-p(n-1))/p(n-1)* p(0))^ (1/k).
How this can be solved and plot using Matlab.
답변 (1개)
Walter Roberson
2016년 1월 17일
0 개 추천
You have gamma= [0,1] which is a vector. You have gamma^k . You cannot raise a vector to a power in MATLAB: you can only raise square matrices to a power. You could raise each element of the vector to a power, gamma.^k but that is going to return a vector result, which implies that the output of p(n) would have to be a vector, and then you would fail the multiplications the next time around. Unless you changed them to element-by-element multiplications...
카테고리
도움말 센터 및 File Exchange에서 Gamma Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!