Question

%code_5_1_Sayama.m
%
% This script makes a phase portrait for
% x(n) = 0.5*x(n-1) + y(n-1);
% y(n) = -0.5*x(n-1) + y(n-1);
%
% Initial conditions:
% x0 ranges from -2 to 2 in increments of 0.5
% y0 ranges from -2 to 2 in increments of 0.5
%
% t=30 timesteps
%
% Modified from Sayama, by C. Bliss
% ======================================================================
t=30; %timesteps
x=zeros(1,t);
y=zeros(1,t);

for a=-2:0.5:2
for b=-2:0.5:2
%initialize x and y
x(1)=a;
y(1)=b;
  
%run the simulation
for n=2:t
x(n) = 0.5*x(n-1) + y(n-1);
y(n) = -0.5*x(n-1) + y(n-1);
end; %for n
plot(x,y)
hold on
end; %for b
end; %for a
  Modify the Matlab code: code 51 Sayama.m to fit the following model: x(n)-0.6*x(n-1)+y(n-1: y(n)--0.2*x(n-1 ) + y(n-1 ); and

0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

t=30; %timesteps
x=zeros(1,t);
y=zeros(1,t);
a=[2,-1];
b=[-2,3];
for i=1:2
%initialize x and y
x(1)=a(i);
y(1)=b(i);

%run the simulation
for n=2:t
x(n) = 0.6*x(n-1) + y(n-1);
y(n) = -0.2*x(n-1) + y(n-1);
end; %for n
plot(x,y)
hold on
end

Figure 1 File Edit View Insert Tools Desktop Window Help .2 .3 53 .2 O Type here to search A ︿wpd, ENG 1126 AM US 02/21/19

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
%code_5_1_Sayama.m % % This script makes a phase portrait for % x(n) = 0.5*x(n-1) + y(n-1);...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT