Matlab Function returns values
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi. I have written a function which should return two sequences but it returns only single sequence. I have attached the code below if any one help me in this regard. Thanks in advance
function [X, Y ]= Hybrid(a,b,w0,s0,c,u);
%a=1.4, b=0.3, wo= 0.1, s0=0.1, c=0.4, u=0.9
x(1)=0;
y(1)=0;
x0=0;y0=0;
% Initialize
t=0.4-6/(1+x0^2+y0^2);
x(1,1)=1+u*(x0*cos(t)-y0*sin(t));% mu is u
y(1,1)=u*(x0*sin(t)+y0*cos(t));
% Simulate
n=10000;
X1=[];
Y1=[];
for i=2:n
t=0.4-6/(1+x(i-1,1)^2+y(i-1,1)^2);
x(i,1)=1+u*(x(i-1,1)*cos(t)-y(i-1,1)*sin(t));
x_1(i,1)=mod(ceil(abs(x(i))*10000),256);
%x2_new = unique(x_1,'stable');
y(i,1)=u*(x(i-1,1)*sin(t)+y(i-1,1)*cos(t));
y_1(i,1)=mod(ceil(abs(y(i,1))*10000),256);
%y2_new=unique(y_1,'stable');
X1=x_1;
Y1=y_1;
end
plot(x,y,'.','MarkerSize',4)
X=unique(mod(x_1,256),'stable')'; % unique pooints of x chaotic sequence
Y=unique(mod(y_1,256),'stable')'; % unique point of y choatic sequence
end
It returns only X sequence
0 Commenti
Risposta accettata
the cyclist
il 8 Feb 2021
How are you calling the function? If you call it like this
Hybrid(a,b,w0,s0,c,u)
then it will only return the first output. But it should return both if you call it like this
[X,Y]= Hybrid(a,b,w0,s0,c,u)
If that does not explain it, please post more information about how you are calling the function.
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!