Changing parameters while simulation

4 views (last 30 days)
The following code is a part of my program :
a = [1 -1.98 1.284 -0.272];
b = [0 5 2 6];
th = poly2th(a,b)
u = rand(1000,1);
y = idsim(u,th);
% now i want to change the parameters say at 300th sample; so
a= [ 1 -2 1 -0.4];
b = [0 5 2 6];
So my question is ; I want my values of output y i.e y (1 :299 ) should be from unchanged parameters and y (300 :1000 ) should be from parameters after i change.
those values of y should be concatenated in the column vector of y (1:1000)
So can anyone help me this..?

Accepted Answer

Walter Roberson
Walter Roberson on 21 Mar 2014
th1 = poly2th(a, b);
u1 = rand(1000, 1);
y1 = idsim(u1, th1);
y2 = [reshape(y(1:299),[], 1); reshape(y1(300:1000), [], 1)];

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!