Message Boards Message Boards

0
|
1747 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Assignment inside While[ ]?

Posted 3 years ago

Hi, I need to plot the eigenvalues calculated by the function Eigenvalue. so: during a while loop I build a matrix, I evaluate the eigenvalues and I need store them in a vector. but I can't use %[[1]] for assign the value obtained in the vector that I will use for plot. How can I solve?

POSTED BY: marco stefanini
Posted 3 years ago

Hi Marco,

Avoid using %, assign the result to a symbol and use it.

While[Va < 1.8, 
Stato = Inverse[Ma] . ((-Ω^2*Ka) - (Va^2*Fexta));
eigenValues = Eigenvalues[Stato];
a2 = eigenValues[[1]];
b2 = eigenValues[[2]];
Print[a2];
λ[i] = {a2, b2};
i = i + 1;
Va = Va + 0.01;]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract