How to solve following difference equation using Matlab

2 Ansichten (letzte 30 Tage)
Sobin cc
Sobin cc am 17 Jan. 2016
Beantwortet: Walter Roberson am 17 Jan. 2016
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.

Antworten (1)

Walter Roberson
Walter Roberson am 17 Jan. 2016
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...

Kategorien

Mehr zu Gamma Functions finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by