Matlab script for a dynamical system [closed]












0












$begingroup$


The code



 function hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end


Is giving me zeros, can anyone see why?










share|cite|improve this question









$endgroup$



closed as off-topic by copper.hat, Siong Thye Goh, Leucippus, user10354138, Lord Shark the Unknown Dec 8 '18 at 7:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about mathematics, within the scope defined in the help center." – copper.hat, Siong Thye Goh, user10354138, Lord Shark the Unknown

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    What are you hoping will happen?
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:25










  • $begingroup$
    What values do you give to a, b, xn, yn and upper?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 7:26










  • $begingroup$
    @copper.hat generate some values corresponding to iterations of the map?
    $endgroup$
    – user21312
    Dec 7 '18 at 7:31










  • $begingroup$
    @MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:32










  • $begingroup$
    There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:34


















0












$begingroup$


The code



 function hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end


Is giving me zeros, can anyone see why?










share|cite|improve this question









$endgroup$



closed as off-topic by copper.hat, Siong Thye Goh, Leucippus, user10354138, Lord Shark the Unknown Dec 8 '18 at 7:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about mathematics, within the scope defined in the help center." – copper.hat, Siong Thye Goh, user10354138, Lord Shark the Unknown

If this question can be reworded to fit the rules in the help center, please edit the question.
















  • $begingroup$
    What are you hoping will happen?
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:25










  • $begingroup$
    What values do you give to a, b, xn, yn and upper?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 7:26










  • $begingroup$
    @copper.hat generate some values corresponding to iterations of the map?
    $endgroup$
    – user21312
    Dec 7 '18 at 7:31










  • $begingroup$
    @MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:32










  • $begingroup$
    There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:34
















0












0








0





$begingroup$


The code



 function hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end


Is giving me zeros, can anyone see why?










share|cite|improve this question









$endgroup$




The code



 function hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end


Is giving me zeros, can anyone see why?







matlab






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Dec 7 '18 at 7:20









user21312user21312

33




33




closed as off-topic by copper.hat, Siong Thye Goh, Leucippus, user10354138, Lord Shark the Unknown Dec 8 '18 at 7:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about mathematics, within the scope defined in the help center." – copper.hat, Siong Thye Goh, user10354138, Lord Shark the Unknown

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by copper.hat, Siong Thye Goh, Leucippus, user10354138, Lord Shark the Unknown Dec 8 '18 at 7:31


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "This question is not about mathematics, within the scope defined in the help center." – copper.hat, Siong Thye Goh, user10354138, Lord Shark the Unknown

If this question can be reworded to fit the rules in the help center, please edit the question.












  • $begingroup$
    What are you hoping will happen?
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:25










  • $begingroup$
    What values do you give to a, b, xn, yn and upper?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 7:26










  • $begingroup$
    @copper.hat generate some values corresponding to iterations of the map?
    $endgroup$
    – user21312
    Dec 7 '18 at 7:31










  • $begingroup$
    @MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:32










  • $begingroup$
    There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:34




















  • $begingroup$
    What are you hoping will happen?
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:25










  • $begingroup$
    What values do you give to a, b, xn, yn and upper?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 7:26










  • $begingroup$
    @copper.hat generate some values corresponding to iterations of the map?
    $endgroup$
    – user21312
    Dec 7 '18 at 7:31










  • $begingroup$
    @MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:32










  • $begingroup$
    There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
    $endgroup$
    – copper.hat
    Dec 7 '18 at 7:34


















$begingroup$
What are you hoping will happen?
$endgroup$
– copper.hat
Dec 7 '18 at 7:25




$begingroup$
What are you hoping will happen?
$endgroup$
– copper.hat
Dec 7 '18 at 7:25












$begingroup$
What values do you give to a, b, xn, yn and upper?
$endgroup$
– Math Girl
Dec 7 '18 at 7:26




$begingroup$
What values do you give to a, b, xn, yn and upper?
$endgroup$
– Math Girl
Dec 7 '18 at 7:26












$begingroup$
@copper.hat generate some values corresponding to iterations of the map?
$endgroup$
– user21312
Dec 7 '18 at 7:31




$begingroup$
@copper.hat generate some values corresponding to iterations of the map?
$endgroup$
– user21312
Dec 7 '18 at 7:31












$begingroup$
@MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
$endgroup$
– user21312
Dec 7 '18 at 7:32




$begingroup$
@MathFun123 I started with the standard $a=1.4$ $b=0.3$ and took the origin as inital value and $100$ iterations.
$endgroup$
– user21312
Dec 7 '18 at 7:32












$begingroup$
There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
$endgroup$
– copper.hat
Dec 7 '18 at 7:34






$begingroup$
There are no outputs declared. What are you expecting the function to do? Print out some values at each iteration. Try something.
$endgroup$
– copper.hat
Dec 7 '18 at 7:34












1 Answer
1






active

oldest

votes


















0












$begingroup$

Try this:



function [Xval,Yval] = hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end





share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:44










  • $begingroup$
    I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:47










  • $begingroup$
    Yes I also don't know why, but does it work now?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 8:14










  • $begingroup$
    yes it works fine now
    $endgroup$
    – user21312
    Dec 7 '18 at 19:34




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0












$begingroup$

Try this:



function [Xval,Yval] = hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end





share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:44










  • $begingroup$
    I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:47










  • $begingroup$
    Yes I also don't know why, but does it work now?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 8:14










  • $begingroup$
    yes it works fine now
    $endgroup$
    – user21312
    Dec 7 '18 at 19:34


















0












$begingroup$

Try this:



function [Xval,Yval] = hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end





share|cite|improve this answer









$endgroup$













  • $begingroup$
    thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:44










  • $begingroup$
    I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:47










  • $begingroup$
    Yes I also don't know why, but does it work now?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 8:14










  • $begingroup$
    yes it works fine now
    $endgroup$
    – user21312
    Dec 7 '18 at 19:34
















0












0








0





$begingroup$

Try this:



function [Xval,Yval] = hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end





share|cite|improve this answer









$endgroup$



Try this:



function [Xval,Yval] = hennonMap(a, b, xn, yn, upper)
Xval = zeros(upper, 1);
Yval = zeros(upper, 1);
for i=1:upper
Xval(i) = xn;
Yval(i) = yn;
x = yn + 1 - a*xn^2;
y = b * xn;
xn = x;
yn = y;
end
end






share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Dec 7 '18 at 7:42









Math GirlMath Girl

631318




631318












  • $begingroup$
    thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:44










  • $begingroup$
    I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:47










  • $begingroup$
    Yes I also don't know why, but does it work now?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 8:14










  • $begingroup$
    yes it works fine now
    $endgroup$
    – user21312
    Dec 7 '18 at 19:34




















  • $begingroup$
    thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:44










  • $begingroup$
    I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
    $endgroup$
    – user21312
    Dec 7 '18 at 7:47










  • $begingroup$
    Yes I also don't know why, but does it work now?
    $endgroup$
    – Math Girl
    Dec 7 '18 at 8:14










  • $begingroup$
    yes it works fine now
    $endgroup$
    – user21312
    Dec 7 '18 at 19:34


















$begingroup$
thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
$endgroup$
– user21312
Dec 7 '18 at 7:44




$begingroup$
thanks, I just skipped the function part instead then I got it to work. But now I understand the problem with the other one. Ill try this before taking this answer.
$endgroup$
– user21312
Dec 7 '18 at 7:44












$begingroup$
I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
$endgroup$
– user21312
Dec 7 '18 at 7:47




$begingroup$
I do find it kind of odd that "Xval" returns zeros even if it didnt get "saved", if it didnt get saved it should just say "error" when calling it.
$endgroup$
– user21312
Dec 7 '18 at 7:47












$begingroup$
Yes I also don't know why, but does it work now?
$endgroup$
– Math Girl
Dec 7 '18 at 8:14




$begingroup$
Yes I also don't know why, but does it work now?
$endgroup$
– Math Girl
Dec 7 '18 at 8:14












$begingroup$
yes it works fine now
$endgroup$
– user21312
Dec 7 '18 at 19:34






$begingroup$
yes it works fine now
$endgroup$
– user21312
Dec 7 '18 at 19:34





Popular posts from this blog

Plaza Victoria

Brian Clough

Cáceres