Recieving error that states "Vectors must be the same length".

I am trying to plot Y in terms of X. I was able to plot the first graph as incremented by values of pi/2. However, I have not changed the bounds of x, just changed the value of the intermediate steps. ie; from x= -pi:pi/2:pi; to x=-pi:pi/3:pi; When doing so, I receive the error that says vectors must be of the same length. Why is this?

Respuestas (1)

Thorsten
Thorsten el 18 de En. de 2016
By changing the increment you have changed the length of X (from 5 to 7 in your case). If Y matches X (with 5 elements), it does not match X with 7 elements. So you have to compute Y for your new X with 7 values, to avoid the error.

2 comentarios

Thanks, I couldn't figure out why the vector change when I was only changing the increments and not the bounds.
If you are happy with my answer, please formally accept the answer.

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.

Preguntada:

el 15 de En. de 2016

Comentada:

el 18 de En. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by