How to graph/plot this equation in MATLAB

6 visualizaciones (últimos 30 días)
Zainab Sayed Hassan
Zainab Sayed Hassan el 15 de Nov. de 2019
Respondida: Raunak Gupta el 18 de Nov. de 2019
How to graph/plot this equation in MATLAB
y(t)= 5e^(−t/300)
  2 comentarios
Walter Roberson
Walter Roberson el 15 de Nov. de 2019
MATLAB has no implicit multiplication: you must use explicit multiplication, typically the .* operator
MATLAB uses exp(value) for e^value
Muhammad Usman
Muhammad Usman el 16 de Nov. de 2019
It's quite easy to do, define an array for 't' and then write your equation by keeping in mind the multiplication rule described by Walter Roberson and simply use plot command

Iniciar sesión para comentar.

Respuestas (1)

Raunak Gupta
Raunak Gupta el 18 de Nov. de 2019
Hi,
For plotting the graph of some function/equation you are required to give an interval on which the function value is displayed. You may use fplot for plotting graph of a function.
Following command might help.
fplot(@(t) 5*exp(-t/300),[0,10],'MeshDensity',500);
Here the first part is the function you want to plot, second is for the range you plot it for and MeshDensity represents the number of points for which the function is evaluated. As per the documentation, for a ‘MeshDensity’ of 500 total number of evaluations are 999.

Categorías

Más información sobre Mathematics 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