stem-plot difference of equations
显示 更早的评论
Here is the question
Find numerically and stem-plot the solutions of the difference equations [1<=k<=10]
a. y(k+1) - 3*k*y(k) = 0
b. y(y+1) - k*y(k) = 1
assume that y(1)=1
not sure if i am looking at this properly but here is what i was thinking. a and b do not have the same y values after 1 since in order to get 0 for the first one y(2) needs to be 3 while for equation b y(2) needs to be 2. So solve them differently and then plot? i am not sure which would be my x and y for stem plot as well. This looks simple but its confusing me not sure if am over thinking.
Thank you for your time
3 个评论
Azzi Abdelmalek
2013-12-16
Your question is not clear. Do you want to solve two different equations or one system of two equations?
Tony
2013-12-16
Walter Roberson
2013-12-24
Are you sure that (b) should have y(y+1) on the left side, and not y(k+1) ??
采纳的回答
更多回答(1 个)
Youssef Khmou
2013-12-24
Tony, try this iterative method :
y1=zeros(10,1);
y2=zeros(10,1);
y1(1)=1;y2(1)=1; % initial conditions
for t=1:9
y1(t+1)=3*t*y1(t);
y2(t+1)=1+t*y2(t);
end
k=1:10;
figure, stem(k,y1), hold on,stem(k,y2,'r')
类别
在 帮助中心 和 File Exchange 中查找有关 Plot Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!