Plotting 2D graph problem with x-axis spacing.
Mostrar comentarios más antiguos
I want to plot y = 2*exp((t.^2/)2) in MATLAB in the range of 0 to 3. I can't seem to get the vector length correctly and getting:
error using plot. Vectros must be the same length.
I understand that the vectors need to be the same length, but cannot actually implement this.
Code:
x = 0:0.1:3;
y = 2*(exp((t.^(2))/2));
plot (x,y,'r');
Without the 'x variable, the plot comes to:
plot (y,'r');

Comparing this to an online plotting tool for

gives:

Which does not seem to be exactly what I am getting as a result in MATLAB.
- Is the equation for plotting written correctly?
- How do I get the x-axis to range from 0 to 3?
Many thanks for any suggestions.
2 comentarios
KALYAN ACHARJYA
el 17 de Mzo. de 2018
Editada: KALYAN ACHARJYA
el 17 de Mzo. de 2018
From the above expression, x is independent with y. And what about the x range. Clarify "A Spacing" means?

Ryan Rizzo
el 17 de Mzo. de 2018
Editada: Ryan Rizzo
el 17 de Mzo. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
