Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
In advance excuse me for my poor english I'm Spanish.
Hi everyone, I'm programming a Newmark's Method and I have some trouble trying to obtain the intermediate results for my program, currently the program only shows the last value of the variables, and I want to ask you some help to be able to obtain and then to plot each of the results for each step.
Thx a lot guys!
Solved! Go to Solution.
Maikel Nite wrote:
currently the program only shows the last value of the variables
This is because while you calculate and keep all results, you return only the values with the last index (i+1). Just omit the indices in the return statement and you get all four steps.
I noticed two other things, though. The break is without function as you compare a three element vector (x[i) to a constant (R=3). The whole inner for-loop(j) seems to be obsolete as you just calculate and assign the same values three times the way you did it. What did you intend?
and then to plot each of the results for each step.
What would you plot with just three iteration steps and which variable against which?
BTW, no need to crosspost.
Maikel Nite wrote:
currently the program only shows the last value of the variables
This is because while you calculate and keep all results, you return only the values with the last index (i+1). Just omit the indices in the return statement and you get all four steps.
I noticed two other things, though. The break is without function as you compare a three element vector (x[i) to a constant (R=3). The whole inner for-loop(j) seems to be obsolete as you just calculate and assign the same values three times the way you did it. What did you intend?
and then to plot each of the results for each step.
What would you plot with just three iteration steps and which variable against which?
BTW, no need to crosspost.
Thank you very much for answering so fast. It worked changing the program as you told me.
and then to plot each of the results for each step.
What would you plot with just three iteration steps and which variable against which?
What I want is to take the first number in each vector for example x vector and represent it against time.
what I'm modelling are 3 masses that are related (not yet implemented that in the program) so I want to be able to plot the x position at each time step. Each vector (x for example) has the 3 masses involved so now I would like to be able to plot how mass 1 evolves along time so with mass 2 and 3.
If you could help me again I would appreciate.
Thx in advance.
BTW you're right, I don't really need the break line.
Maikel Nite wrote:
Thank you very much for answering so fast. It worked changing the program as you told me.
and then to plot each of the results for each step.
What would you plot with just three iteration steps and which variable against which?
What I want is to take the first number in each vector for example x vector and represent it against time.
what I'm modelling are 3 masses that are related (not yet implemented that in the program) so I want to be able to plot the x position at each time step. Each vector (x for example) has the 3 masses involved so now I would like to be able to plot how mass 1 evolves along time so with mass 2 and 3.
If you could help me again I would appreciate.
Thx in advance.
BTW you're right, I don't really need the break line.
Ok, but what time? I noticed you had defined a range variable with 601 elelemts for it but you did not use it in your iteration. Nevertheless you used the Delta_t.
Attached find the plot of the three masses along with the three iteration steps, but I guess thats not what you are looking for, right?
Actually that was exactly what I wanted to obtain. The only thing that I've changed was the step definition as i·Delta(t).
I really appreciate your help. Thanks a lot.
Greetings from Spain.
Great that it works for you. I thought you are after a 600 step iteration.
One thing you probably already are aware. You may plot the three graphs singly by using the column select operator. That way you could format the plots differently.
I want the 600 step iterarion but I still have to define how the forces vary along the time.
Thank you for the advice about how to plot the different plots, I was already thinking how to do it, so it was very convenient.
Greetings
Maikel Nite wrote:
I want the 600 step iterarion but I still have to define how the forces vary along the time.
Thank you for the advice about how to plot the different plots, I was already thinking how to do it, so it was very convenient.
Greetings
See you in the next thread 😉