Unable to perform assignment because the left and right sides have a different number of elements.

1 vue (au cours des 30 derniers jours)
Hey!
I need to plot an impulse response function for a horizon of 20 periods, as a deviation of the baseline in the following terms:
• First, let yt−1 = 1 and et = 0: how does yt evolve?
• Now, let yt−1 = 1, but also et = 1 (i.e. a single shock at time t): how does yt evolve?
This is the code I came up with but I got the following error sign 'Unable to perform assignment because the left and right sides have a different number of elements.'
Can anyone help me out?
IRF_y1 = zeros(20,1);
IRF_y1(1) = c + phi+1;
for i = 2:20
IRF_y1(i) = c +phi *IRF_y1 (i-1);
end
figure(5)
plot(1:20, IRF_y1-1, '* -', 'Linewidth', 1.5)
xlabel ('horizon')
ylabel('Deviation of y_t from baseline')

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by