How to solve following difference equation using Matlab
Show older comments
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.
Answers (1)
Walter Roberson
on 17 Jan 2016
0 votes
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...
Categories
Find more on Gamma Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!