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
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Pole and Zero Locations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!