Borrar filtros
Borrar filtros

why is my plot not working

3 visualizaciones (últimos 30 días)
Colby Jennings
Colby Jennings el 15 de Abr. de 2021
Comentada: Colby Jennings el 15 de Abr. de 2021
I have copied the format of plot code directly, but it doesnt like my equation. I have tried everything I know please help, im dying.

Respuesta aceptada

David Hill
David Hill el 15 de Abr. de 2021
t=1:10;
F=1./(4.^t)-1./(5.^t);
plot(t,F);
  2 comentarios
Daniel Pollard
Daniel Pollard el 15 de Abr. de 2021
This works because of the . used before each operation. In your code, you tried
1/4^x
which the matlab code interprets as you trying to raise a number (4) to the power of a vector, x. That doesn't really work in normal mathematics, and MATLAB would have thrown an error.
David's code instead writes
1/4.^x
which MATLAB reads to mean "for each element xi in x, calculate 1/4^xi". This is what you intended and is the usual way of calculating values for plotting.
Colby Jennings
Colby Jennings el 15 de Abr. de 2021
oh okay. thankyou

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Graphics Objects en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by