dynamic system whose position coordinates are defined by this relationship

1 次查看(过去 30 天)
dynamic system whose position coordinates are defined by relationship:
x(k+1)= 1 + y(k) - 1.4*x(k)^2
y(k+1)= 0.3*x(k)
function [x y] = MEMS_chaos (k)
x(0)=y(0)=0;
for i = 0:k
x(i+1) = 1 + y(i)-1.4*x(i)^2
y(i+1) = 0.3*x(i)
[x,y]
end
end
.....I tried this but it's vain...i cant find the errors

采纳的回答

Walter Roberson
Walter Roberson 2019-11-13
MATLAB never permits indexing at 0. You will need to add 1 to all of your indices. x(0+1) and so on.
Also, MATLAB does not permit transitive assignment. You will need to create two assignment statements.
x(0+1) = 0;
y(0+1) = 0;
for i = 0:k
x(i+1+1) = 1 + y(i+1)-1.4*x(i+1)^2
y(i+1+1) = 0.3*x(i+1)
[x,y]
end
You should ask yourself whether displaying the ever-longer x and y vectors is part of the question, or if you are just intended to return them.
You should also carefully consider how many items long the output vectors are intended to be. for i=0:k does k+1 steps . Are the initial positions (0,0) to be part of the output vectors? If so then is the expected length k exactly, or k+1, or k+2 ?

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Time and Frequency Domain Analysis 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by