Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Hi
I tried to find the max value of a solution from odesolve.
As argument I used a vector. It works fine for the direct solution of odesolve. But if I try to use a function on the solution (derivate with respect to time) I get stucked.
You have to scroll down a little bit and you will find the explained problem.
Thanks in advance for helping me out.
Solved! Go to Solution.
1) in "max(derv(vh,i))" there is missing the closing parenthesis
2) your function "derv" uses indices i-1 and i+1. Therefore you can only apply indices from 1 to pkt-1 and not, as you do, from 0 to pkt. Thats the reason for the error regarding the array index you get everytime you call derv(). The two invalid indices being 0-1 and pkt+1.
3) Even if you correct the above you would be disappointed. You feed a range variable in derv(...) and so max(..) aould be applied to every element singly so you would get pkt times the max of a single constant.
You have to create a vector to get max to work
Edited: Changed file, added another method to get the derivative to get the maximum with better accuracy.
1) in "max(derv(vh,i))" there is missing the closing parenthesis
2) your function "derv" uses indices i-1 and i+1. Therefore you can only apply indices from 1 to pkt-1 and not, as you do, from 0 to pkt. Thats the reason for the error regarding the array index you get everytime you call derv(). The two invalid indices being 0-1 and pkt+1.
3) Even if you correct the above you would be disappointed. You feed a range variable in derv(...) and so max(..) aould be applied to every element singly so you would get pkt times the max of a single constant.
You have to create a vector to get max to work
Edited: Changed file, added another method to get the derivative to get the maximum with better accuracy.
Thanks a lot. I got it right now. Perfect explanations!
As I changed some things I got other troubles.
For example with the mathcad derivative. If I don't use the bold self-written formula, it does not calculate to the end. I marked the questions green. Feel free to comment.
Its important to keep range variables and vectors apart!
See if the attached helps.
wow, perfect. Thank you so much for the explications!
absolutely stunned about people's help here. You helped me a lot.
edit: I hope one day I have the capabilities to help others too
Leander Rankwiler wrote:
wow, perfect. Thank you so much for the explications!
absolutely stunned about people's help here. You helped me a lot.edit: I hope one day I have the capabilities to help others too
Thats neighbourly help in our case 😉
Greetings to Switzerland!