How can i fix the error 'Index exceeds the number of array elements (51)'

1 visualización (últimos 30 días)
x = [0:0.1:5];
y = sin(x)/x;
plot(x, y), xlabel('xi'), ylabel('Theta'), title('Solution to Lane Emden Equation'),
grid on, axis equal;ax = gca; ylabel = texlabel(y); xlabel = texlabel(x);
ax.XAxisLocation = 'origin'
ax.YAxisLocation = 'origin'
Index exceeds the number of array elements (51).

Respuesta aceptada

Birdman
Birdman el 6 de Abr. de 2020
You need to apply elementwise division:
x = [0:0.1:5];
y = sin(x)./x;
plot(x, y), xlabel('xi'), ylabel('Theta'), title('Solution to Lane Emden Equation'),
grid on, axis equal;ax = gca; ylabel = texlabel(y); xlabel = texlabel(x);
ax.XAxisLocation = 'origin'
ax.YAxisLocation = 'origin'

Más respuestas (0)

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by