How to make time shift in a vector using non integer values?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Kim Ibrahim
el 11 de Jun. de 2021
I need to implement this equation
I(t-Ts)= co*n(t) +c1* n(t-Ts)
Where Ts is 1 nanosecond, so I keep getting an error " Array indices must be positive or logical values". How can I implement that shift in time? Thank you.
2 comentarios
Stephen23
el 11 de Jun. de 2021
Most likely you are confusing data (e.g. time) with code (e.g. indices). Please show your code.
Respuesta aceptada
Adam Danz
el 11 de Jun. de 2021
I(t-Ts)= co*n(t) +c1* n(t-Ts)
I'm guessing that t has a value of 1 at some point and ts=1 nanosecond, so (t-ts)=0 at some point. As the error message indicates, the array indices must be positive values (or logical values).
Other possibilities are that (t-ts) results in a positive non-integer value or a negative value, both of which cannot be used as indices.
Note that this index problem happens with I(t-Ts) and with n(t-Ts). Without knowing more about what you're doing, I can't provide a more specific solution.
6 comentarios
Adam Danz
el 13 de Jun. de 2021
Glad I could point you in the right direction. If this answered your question, please consider accepting the answer (blue "accept this answer" button). If you have any other questions on this topic, let us know.
Más respuestas (0)
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!