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?
matlab
$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.
|
show 8 more comments
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?
matlab
$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
|
show 8 more comments
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?
matlab
$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
matlab
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
|
show 8 more comments
$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
|
show 8 more comments
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
$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
add a comment |
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
$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
add a comment |
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
$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
add a comment |
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
$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
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
add a comment |
$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
add a comment |
$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